diff --git a/applications/core.c b/applications/core.c index 5c4cb2c..5571a8b 100644 --- a/applications/core.c +++ b/applications/core.c @@ -728,6 +728,7 @@ void initTT() LOG_W("TT is already running."); return; } + set3SRTC(); initThread = rt_thread_create("initTT", initTT_thread_entry, RT_NULL, 1024 * 5, 25, 10); /* 创建成功则启动线程 */ if (initThread != RT_NULL) diff --git a/applications/func/func.c b/applications/func/func.c index 864ee42..09c47d9 100644 --- a/applications/func/func.c +++ b/applications/func/func.c @@ -1696,12 +1696,11 @@ void reportINFO(void) void set3SRTC(void) { uint8_t cmd[16]={0x5A, 0xA5, ADDR_3S, ADDR_ANJI, _CMD_SET_RTC >> 8, _CMD_SET_RTC & 0xFF, 0x00, 0x06 }; - uint8_t tm[10]; - time2Byte(tm); - memcpy(cmd+8,tm,6); - cmd[14]=bccCRC(cmd+2, 14); + + time2Byte(cmd+8); + cmd[14]=bccCRC(cmd+2, 16-4); cmd[15]=0xED; - LOG_HEX("sRTC",16,cmd,sizeof(cmd)); + LOG_HEX("cmdRTC",16,cmd,sizeof(cmd)); formatAndSendTo3S(cmd, sizeof(cmd)); } @@ -1774,6 +1773,7 @@ MSH_CMD_EXPORT(isEthUP,isEthUP); MSH_CMD_EXPORT(reportSysCfg,reportSysCfg); MSH_CMD_EXPORT(d_isInFence,d_isInFence); MSH_CMD_EXPORT(d_sw,msw); +MSH_CMD_EXPORT(set3SRTC,发送指令设置RTC); #endif