From e12384f6c743ea4e1ba17a4c14b9f2ec5bf4f431 Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Wed, 16 Sep 2026 15:49:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BA=86=E4=B8=80=E6=97=A6?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E5=BC=82=E5=B8=B8=E6=97=A0=E6=B3=95=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BF=AE=E6=94=B9=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E4=B8=BA1s=E5=8F=91=E4=B8=80=E6=AC=A1=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E9=94=99=E8=AF=AF=E7=A0=81=E3=80=82=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=AC=A1=E6=95=B0=E5=8F=AF=E4=BB=A5=E8=B0=83?= =?UTF-8?q?=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RBcore/client_setting.c | 6 +++--- RBcore/daemon_task.c | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/RBcore/client_setting.c b/RBcore/client_setting.c index 9c1289a..a6266d2 100644 --- a/RBcore/client_setting.c +++ b/RBcore/client_setting.c @@ -83,7 +83,9 @@ void decode_PV(const char *_pBuffer, uint32_t _iSize) if(decoded_PV_variable.TimeStamp>decoded_PV.TimeStamp) { - decoded_PV=decoded_PV_variable; + MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_MK32_SERIAL, NULL, 0); + MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_MK32_UDP, NULL, 0);// udp还没实现这里先防止报错 + decoded_PV=decoded_PV_variable; MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_GET_PV, (void *)&decoded_PV, sizeof(decoded_PV)); } } @@ -126,8 +128,6 @@ static void SendIV_ModuleHandler(const Msg_t *pstMsg) g_IV_buffer[IV_o_stream.bytes_written + 2] = (crc>>8) &0xff; g_IV_buffer[IV_o_stream.bytes_written + 3] = crc & 0xff;; - MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_MK32_SERIAL, NULL, 0); - MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_MK32_UDP, NULL, 0);// udp还没实现这里先防止报错 rd_ComSend(g_ptlpuart, g_IV_buffer, IV_o_stream.bytes_written + 4); } break; diff --git a/RBcore/daemon_task.c b/RBcore/daemon_task.c index 54c3136..6e68343 100644 --- a/RBcore/daemon_task.c +++ b/RBcore/daemon_task.c @@ -19,12 +19,13 @@ #include "BHBF.h" #include "msg_center.h" #include "bsp_Error.pb.h" +#include "rd_time.h" /*----------------------------------------------* * 常量/宏定义(前置,供模块级变量与函数使用) * *----------------------------------------------*/ #define COM_ERROR_MODULE_NUM 7 // ComError 模块数量(位 0~6) -#define COM_ERROR_TIMEOUT_THRESHOLD 8000 // 连续 N 次未收到正常信号判定为模块异常 +#define COM_ERROR_TIMEOUT_THRESHOLD 500 // 连续 N 次未收到正常信号判定为模块异常 /*----------------------------------------------* * 外部变量说明 * @@ -84,6 +85,7 @@ int32_t Get_BIT(int32_t* num,int32_t k) *****************************************************************************/ void daemon_PollComError(void) { + static uint32_t uiLastSendTick = 0; for (int32_t i = 0; i < COM_ERROR_MODULE_NUM; i++) { if (Get_BIT(&g_iCom_Error_Code, i) == 1) @@ -92,6 +94,12 @@ void daemon_PollComError(void) SET_BIT_0(&g_iCom_Error_Code, i); g_auiComErrorCount[i] = 0; // 失联计数清零 SET_BIT_0(&g_iCom_Error_Status, i); // 标记模块正常 + uint32_t uiNowTick = Rd_GetTime(); + if ((int32_t)(uiNowTick - uiLastSendTick) >= 1000) + { + uiLastSendTick = uiNowTick; + MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_GET_DAEMON_CODE, &g_iCom_Error_Status, sizeof(int32_t)); + } } else {