1.硬件测试软件,将光敏信息记录到sd卡

This commit is contained in:
payton 2023-07-21 14:10:35 +08:00
parent d64f37f63b
commit 5d45f9e009
3 changed files with 54 additions and 0 deletions

View File

@ -983,6 +983,7 @@
#define SF_BATTERY_TEST DISABLE
#define SF_BATTERY_TEST_FILE "A:\\BATTERY.TXT"
#define SF_HW_TEST_FILE "A:\\HW.TXT"
#define SF_HW_TEST DISABLE
////////////////////sf end////////////////////////////////

View File

@ -524,5 +524,6 @@ void sf_mcu_flag_clear_done(MCU_FLAG_INIT boot_init);
UINT32 sf_get_send_pic_sieze(void);
void sf_para_print(void);
UINT8 sf_convert_power_on_mode(void);
void sf_hw_info_save(char *name);
#endif

View File

@ -2229,6 +2229,11 @@ void sf_add_file_name_to_send_list(char *sendfname)
memcpy(str1, sendfname + 4, 4);
sf_BatteryInfoSave(str1);
#endif
#if SF_HW_TEST == ENABLE
char str2[5] = { 0 };
memcpy(str2, sendfname + 4, 4);
sf_hw_info_save(str2);
#endif
}
/*************************************************
@ -2256,6 +2261,53 @@ void sf_para_print(void)
printf("%s:%d isUsb = %d isCard = %d isCardFull = %d simCardInsert = %ld start mode = %d IRSHTTER = %d\n",__FUNCTION__,__LINE__, isUsb, isCard, isCardFull, simCardInsert, PowerOnMode, IRSHTTER);
}
#if SF_HW_TEST == ENABLE
void sf_hw_info_save(char *name)
{
char *tmpBuf = NULL;
//UINT32 LibatAdc = 0;
//UINT32 batAdc = 0;
//char fileName[64] = {0};
int fd = 0;
//struct stat st;
tmpBuf = malloc(512);
if (tmpBuf == NULL) {
printf("%s:%d tmpBuf malloc err\n", __FUNCTION__, __LINE__);
return;
}
//snprintf(fileName, sizeof(fileName), "%s", SF_HW_TEST_FILE);
if(access(SF_HW_TEST_FILE, F_OK) == 0)
{
printf("fileName:%s\n",SF_HW_TEST_FILE);
fd = open(SF_HW_TEST_FILE, O_APPEND | O_WRONLY);
}
else {
fd = open(SF_HW_TEST_FILE, O_APPEND | O_WRONLY | O_CREAT);
}
sprintf(tmpBuf, "%s IRSHTTER=%d\r\n", name, IRSHTTER);
printf("%s\r", tmpBuf);
if(fd)
{
//fstat(fd, &st);
lseek(fd, 0, SEEK_END);
write(fd, tmpBuf, strlen(tmpBuf));
close(fd);
//printf("Add Success st_size:%ld\n", st.st_size);
}
free(tmpBuf);
}
#endif
#if defined __FREERTOS
int sf_mod_init(void)