diff --git a/bsp/src/bsp_hr.c b/bsp/src/bsp_hr.c index c8f14e7..4fd1fdb 100644 --- a/bsp/src/bsp_hr.c +++ b/bsp/src/bsp_hr.c @@ -2,7 +2,7 @@ * @Author : stark1898y 1658608470@qq.com * @Date : 2024-09-04 17:33:57 * @LastEditors: mbw && 1600520629@qq.com - * @LastEditTime: 2025-01-15 08:53:20 + * @LastEditTime: 2025-01-15 11:04:00 * @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\bsp\src\bsp_hr.c * @Description : * @@ -440,7 +440,7 @@ int Process_Factor_Cmd(rt_uint8_t cmd) { rt_uint8_t time_buf[8] = {0}; - if (*(rt_uint16_t *)FLASH_FACTOR_TIME_NUM_ADDR != 0xE3E9) + if ((*(rt_uint16_t *)FLASH_FACTOR_TIME_NUM_ADDR != 0xE339)||(*(rt_uint16_t *)FLASH_FACTOR_TIME_NUM_ADDR != 0x39E3)) { for (rt_uint8_t i = 0; i < 6; i++) { @@ -452,20 +452,29 @@ int Process_Factor_Cmd(rt_uint8_t cmd) Get_IotImei(imei, FLASH_IOT_IMEI_LEN); Get_IotImsi(imsi, FLASH_IOT_IMSI_LEN); Get_IotIccid(iccid, FLASH_IOT_ICCID_LEN); - rt_sprintf(buf, + int len = rt_snprintf(buf, sizeof(buf), "\r\n[ID :YD4N02/%02d%02d%02d%04d]\r\n" "[IMEI:%s]\r\n" "[IMSI:%s]\r\n" "[CCID:%s]\r\nOK\r\n", time_buf[5], time_buf[4], time_buf[3], cnt, imei, imsi, iccid); - BSP_Hr_Send_Data(buf, rt_strlen(buf)); + BSP_Hr_Send_Data(buf, len); LOG_D("time_buf[2] = %02x time_buf[1] = %02x time_buf[0] = %02x cnt = %04d", time_buf[2], time_buf[1], time_buf[0], cnt); } else { - LOG_E("[%s] is not set\r\n", "factory time"); - BSP_Hr_Send_Data("factory time is not set\r\n", rt_strlen("factory time is not set\r\n")); + Get_IotImei(imei, FLASH_IOT_IMEI_LEN); + Get_IotImsi(imsi, FLASH_IOT_IMSI_LEN); + Get_IotIccid(iccid, FLASH_IOT_ICCID_LEN); + int len = rt_snprintf(buf, sizeof(buf), + "\r\n[ID :YD4N02/%02d%02d%02d%04d]\r\n" + "[IMEI:%s]\r\n" + "[IMSI:%s]\r\n" + "[CCID:%s]\r\nOK\r\n", + time_buf[5], time_buf[4], time_buf[3], 1, imei, imsi, iccid); + + BSP_Hr_Send_Data(buf, len); } return RT_EOK; }