Browse Source

上报遥控器连接状态;增加当电机有报警码或遥控器关机时急停

paint_robot_new-v1.5
Lizongdi 2 weeks ago
parent
commit
37f2076d3b
  1. 6
      project/paint_robot_new/paint_robot_new.c

6
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)); 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_MOTOR, MOTOR_POWER_DISABLE, NULL, 0);
MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_STOP_ALL, 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) if ((int32_t)(uiNowTick - uiLastSendTick) >= IV_SEND_TIME)
{ {
uiLastSendTick = uiNowTick; uiLastSendTick = uiNowTick;
g_stIV.SBUS_State = g_stMK32.IsOnline;
MsgCenter_SendTo(MODULE_NAME_SENDIV, SENDIV_SET_IV, (void *)&g_stIV, sizeof(g_stIV)); MsgCenter_SendTo(MODULE_NAME_SENDIV, SENDIV_SET_IV, (void *)&g_stIV, sizeof(g_stIV));
} }
} }

Loading…
Cancel
Save