Browse Source

优化按键逻辑

paint_robot_new-v1.5
Lizongdi 1 week ago
parent
commit
eb40b15752
  1. 18
      project/paint_robot_new/paint_robot_new.c

18
project/paint_robot_new/paint_robot_new.c

@ -288,16 +288,19 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
g_Is_All_Button_Reset = 1; g_Is_All_Button_Reset = 1;
} }
} }
else if (g_Is_All_Button_Reset == 1) else
{ {
MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_BUTTON_RESET, NULL, 0); MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_BUTTON_RESET, NULL, 0);
} }
if (iMotorOK == 0) // 电机还没初始化完,不执行后边
{
break;
}
// 急停或者遥控器失联 // 急停或者遥控器失联
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_stMK32.CH8_SE == -1000 || g_stMK32.CH8_SE == 1000 || g_stMK32.CH8_SE == 0) || g_stMK32.IsOnline == 0 || g_stIV.Left_Motor_Err != 0 || g_stIV.Right_Motor_Err != 0)
&& (g_stMK32.CH9_SF == -1000 || g_stMK32.CH9_SF == 1000 || g_stMK32.CH9_SF == 0))
|| g_stIV.Left_Motor_Err != 0 || g_stIV.Right_Motor_Err != 0)
{ {
if (g_stIV.Left_Motor_Err != 0 || g_stIV.Right_Motor_Err != 0) if (g_stIV.Left_Motor_Err != 0 || g_stIV.Right_Motor_Err != 0)
{ {
@ -310,16 +313,11 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
break; break;
} }
if (iMotorOK == 0) // 电机还没初始化完,不执行后边
{
break;
}
// 按键处于默认位置安卓界面可控 // 按键处于默认位置安卓界面可控
if ((fabs(g_stMK32.CH2_LY_V) <= 200) && (fabs(g_stMK32.CH3_LY_H) <= 200) if ((fabs(g_stMK32.CH2_LY_V) <= 200) && (fabs(g_stMK32.CH3_LY_H) <= 200)
&& (fabs(g_stMK32.CH0_RY_H) <= 200) && (fabs(g_stMK32.CH1_RY_V) <= 200) && (fabs(g_stMK32.CH0_RY_H) <= 200) && (fabs(g_stMK32.CH1_RY_V) <= 200)
&& (g_stMK32.CH4_SA == 0) && (g_stMK32.CH5_SB == 0) && (g_stMK32.CH4_SA == 0) && (g_stMK32.CH5_SB == 0)
&& (g_stMK32.CH6_SC != -1000) ) && (g_stMK32.CH6_SC == 0) && (g_stMK32.CH7_SD == 0))
{ {
g_stIV.IsWorking = 0; g_stIV.IsWorking = 0;
g_stAngleError_Ctl.m_iAnglelock = 0; // 遥控器复位认为打开角度锁 g_stAngleError_Ctl.m_iAnglelock = 0; // 遥控器复位认为打开角度锁

Loading…
Cancel
Save