添加设置3S的RTC指令,在TT上电后发送

This commit is contained in:
CSSC-WORK\murmur 2023-09-08 17:26:13 +08:00
parent 98a895fb3e
commit 0e90ee806e
2 changed files with 6 additions and 5 deletions

View File

@ -728,6 +728,7 @@ void initTT()
LOG_W("TT is already running."); LOG_W("TT is already running.");
return; return;
} }
set3SRTC();
initThread = rt_thread_create("initTT", initTT_thread_entry, RT_NULL, 1024 * 5, 25, 10); initThread = rt_thread_create("initTT", initTT_thread_entry, RT_NULL, 1024 * 5, 25, 10);
/* 创建成功则启动线程 */ /* 创建成功则启动线程 */
if (initThread != RT_NULL) if (initThread != RT_NULL)

View File

@ -1696,12 +1696,11 @@ void reportINFO(void)
void set3SRTC(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 cmd[16]={0x5A, 0xA5, ADDR_3S, ADDR_ANJI, _CMD_SET_RTC >> 8, _CMD_SET_RTC & 0xFF, 0x00, 0x06 };
uint8_t tm[10];
time2Byte(tm); time2Byte(cmd+8);
memcpy(cmd+8,tm,6); cmd[14]=bccCRC(cmd+2, 16-4);
cmd[14]=bccCRC(cmd+2, 14);
cmd[15]=0xED; cmd[15]=0xED;
LOG_HEX("sRTC",16,cmd,sizeof(cmd)); LOG_HEX("cmdRTC",16,cmd,sizeof(cmd));
formatAndSendTo3S(cmd, sizeof(cmd)); formatAndSendTo3S(cmd, sizeof(cmd));
} }
@ -1774,6 +1773,7 @@ MSH_CMD_EXPORT(isEthUP,isEthUP);
MSH_CMD_EXPORT(reportSysCfg,reportSysCfg); MSH_CMD_EXPORT(reportSysCfg,reportSysCfg);
MSH_CMD_EXPORT(d_isInFence,d_isInFence); MSH_CMD_EXPORT(d_isInFence,d_isInFence);
MSH_CMD_EXPORT(d_sw,msw); MSH_CMD_EXPORT(d_sw,msw);
MSH_CMD_EXPORT(set3SRTC,RTC);
#endif #endif