diff --git a/project/paint_robot_new/paint_robot_new.c b/project/paint_robot_new/paint_robot_new.c index 236c8f1..55d9fc5 100644 --- a/project/paint_robot_new/paint_robot_new.c +++ b/project/paint_robot_new/paint_robot_new.c @@ -262,8 +262,9 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) RD_MEMCPY(&g_stMK32, pstMsg->m_aucData, sizeof(g_stMK32)); } - // 急停 - if (g_stMK32.CH8_SE == -1000 && g_stMK32.CH9_SF == -1000) + // 急停或者遥控器失联 + 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) { MsgCenter_SendTo(MODULE_NAME_MOTOR, MOTOR_POWER_DISABLE, NULL, 0); MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_STOP_ALL, NULL, 0); @@ -526,6 +527,7 @@ void Custom_Task(void *argument) if ((int32_t)(uiNowTick - uiLastSendTick) >= IV_SEND_TIME) { uiLastSendTick = uiNowTick; + g_stIV.SBUS_State = g_stMK32.IsOnline; MsgCenter_SendTo(MODULE_NAME_SENDIV, SENDIV_SET_IV, (void *)&g_stIV, sizeof(g_stIV)); } }