From 5d45f9e0098f189730e5fd2e293ccb01664bed89 Mon Sep 17 00:00:00 2001 From: payton Date: Fri, 21 Jul 2023 14:10:35 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=A1=AC=E4=BB=B6=E6=B5=8B=E8=AF=95=E8=BD=AF?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E5=B0=86=E5=85=89=E6=95=8F=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=88=B0sd=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cardv/SrcCode/PrjCfg_HUNTING_S530.h | 1 + rtos/code/driver/na51089/include/sf_mcu.h | 1 + rtos/code/driver/na51089/source/mcu/sf_mcu.c | 52 +++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/rtos/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h b/rtos/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h index 4d3478ca2..820bd7fed 100644 --- a/rtos/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h +++ b/rtos/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h @@ -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//////////////////////////////// diff --git a/rtos/code/driver/na51089/include/sf_mcu.h b/rtos/code/driver/na51089/include/sf_mcu.h index 445121db7..fcdda2447 100644 --- a/rtos/code/driver/na51089/include/sf_mcu.h +++ b/rtos/code/driver/na51089/include/sf_mcu.h @@ -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 diff --git a/rtos/code/driver/na51089/source/mcu/sf_mcu.c b/rtos/code/driver/na51089/source/mcu/sf_mcu.c index 4e249f09a..49491a602 100644 --- a/rtos/code/driver/na51089/source/mcu/sf_mcu.c +++ b/rtos/code/driver/na51089/source/mcu/sf_mcu.c @@ -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)