diff --git a/RBcore/TL720D.c b/RBcore/TL720D.c index 0999a05..a44465d 100644 --- a/RBcore/TL720D.c +++ b/RBcore/TL720D.c @@ -126,6 +126,7 @@ static void decode_TL720D(const char *buf, uint32_t _iSize) uiLastSendTick = uiNowTick; MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_GET_TL720D_ROLL, (void *)&g_stTL720D.RF_Angle_Roll, sizeof(int32_t)); MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_GET_TL720D_ROLL, (void *)&g_stTL720D.RF_Angle_Roll, sizeof(int32_t)); + MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_TL720D, NULL, 0); } } diff --git a/RBcore/client_setting.c b/RBcore/client_setting.c index 17e5bd3..ca81d3d 100644 --- a/RBcore/client_setting.c +++ b/RBcore/client_setting.c @@ -85,6 +85,7 @@ void decode_PV(const char *_pBuffer, uint32_t _iSize) { decoded_PV=decoded_PV_variable; MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_GET_PV, (void *)&decoded_PV, sizeof(decoded_PV)); + MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_MK32_SERIAL, NULL, 0); } } else if (*(_pBuffer + 2) == 0x02 && *(_pBuffer + 3) == 0x01) //设置PV diff --git a/RBcore/drv_interface.c b/RBcore/drv_interface.c index 8d033b7..eec244f 100644 --- a/RBcore/drv_interface.c +++ b/RBcore/drv_interface.c @@ -255,6 +255,7 @@ void SendIV_Init(void); void TL720D_Init(void); void RBcore_Init(void); void controller_init(void); +void daemon_Init(void); void Drv_InterfaceInit(void) { @@ -304,4 +305,5 @@ void Drv_InterfaceInit(void) (void)osThreadNew(Read_PV, NULL, &Read_PV_attributes); TL720D_Init(); + daemon_Init(); } diff --git a/controller/msp_MK32.c b/controller/msp_MK32.c index 3a8c7d2..dc2801f 100644 --- a/controller/msp_MK32.c +++ b/controller/msp_MK32.c @@ -116,6 +116,7 @@ void decode_MK32(const char *buf, uint32_t _iSize) uiLastSendTick = uiNowTick; MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_GET_MK32, (void *)&RB_MK32, sizeof(RB_MK32)); + MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_MK32_SBUS, NULL, 0); } } @@ -141,4 +142,4 @@ void controller_init(void) .priority = (osPriority_t) osPriorityRealtime1, }; (void)osThreadNew(Read_MK32, NULL, &MK32_Task_attributes); -} \ No newline at end of file +} diff --git a/project/paint_robot_new/paint_robot_new.c b/project/paint_robot_new/paint_robot_new.c index 55d9fc5..e1d5632 100644 --- a/project/paint_robot_new/paint_robot_new.c +++ b/project/paint_robot_new/paint_robot_new.c @@ -51,6 +51,7 @@ static int g_RB_State = 0; // 机器人状态,1表示处于竖直行走模式 static int g_Paint_State = -1; // 喷枪状态,0表示打开,1表示关闭 static int angle_protect_lock = 0; // 为1表示角度异常,触发停车逻辑Move_Halt_AngleError static int g_ipaintOffCount = 0; // Move_Halt_AngleError中的计时,即角度偏移超过多少时间触发停枪 +static int Is_All_Button_Reset = 0; // 1表示按钮正常工作,0表示需要复位 /*----------------------------------------------* * 常量定义 * @@ -262,6 +263,19 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) RD_MEMCPY(&g_stMK32, pstMsg->m_aucData, sizeof(g_stMK32)); } + if (Is_All_Button_Reset == 0) + { + if (g_stMK32.CH4_SA == 0 && g_stMK32.CH5_SB == 0 && g_stMK32.CH6_SC == 0 + && g_stMK32.CH7_SD == 0 && g_stMK32.IsOnline == 1) + { + Is_All_Button_Reset = 1; + } + } + else if (Is_All_Button_Reset == 1) + { + MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_BUTTON_RESET, NULL, 0); + } + // 急停或者遥控器失联 if ((g_stMK32.CH8_SE == -1000 && g_stMK32.CH9_SF == -1000) || g_stMK32.IsOnline == 0 || g_stIV.Left_Motor_Err != 0 || g_stIV.Right_Motor_Err != 0) @@ -269,6 +283,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) MsgCenter_SendTo(MODULE_NAME_MOTOR, MOTOR_POWER_DISABLE, NULL, 0); MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_STOP_ALL, NULL, 0); g_RB_State = 0; + Is_All_Button_Reset = 0; break; } diff --git a/project/paint_robot_new/paint_robot_new_motors.c b/project/paint_robot_new/paint_robot_new_motors.c index 0499cf8..a48a418 100644 --- a/project/paint_robot_new/paint_robot_new_motors.c +++ b/project/paint_robot_new/paint_robot_new_motors.c @@ -113,6 +113,14 @@ static void decode_LeiSaiMotor(const char *_pBuffer, uint32_t _iSize) // 调用电机管理模块解析响应 MotorMgr_ParseResponse(ucMotorID, (const uint8_t *)_pBuffer, _iSize); + if (1 == ucMotorID) + { + MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_LEFT_MOTOR, NULL, 0); + } + else if (2 == ucMotorID) + { + MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_RIGHT_MOTOR, NULL, 0); + } } void MotorTask(void *argument)