Browse Source

解决手动模式下停车关枪逻辑导致的喷枪开关抖动

paint_robot_new-v1.5
Lizongdi 2 weeks ago
parent
commit
dff95dee9e
  1. 9
      project/paint_robot_new/paint_robot_new.c
  2. 2
      project/paint_robot_new/paint_robot_new_motors.c

9
project/paint_robot_new/paint_robot_new.c

@ -114,8 +114,13 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
static int iLeft_Compensation = 0;
static int iRight_Compensation = 0;
static int iVehicleSpeed = 1;
static int iIsStopOffPaint = 0;
switch (pstMsg->m_uiMsgID)
{
case CUSTOM_SET_STOP_OFF_PAINT:
{
iIsStopOffPaint = 1;
}
case CUSTOM_GET_DAEMON_CODE:
{
if (pstMsg->m_uiDataLen >= sizeof(int32_t))
@ -358,12 +363,16 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
if (g_stPV.RunMode == 1)
{
if (g_stMK32.CH6_SC == -1000)
{
if (0 == iIsStopOffPaint)
{
g_Paint_State = 0;
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_CMD_PAINTGUN, &g_Paint_State, sizeof(int));
}
}
else
{
iIsStopOffPaint = 0;
g_Paint_State = 1;
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_CMD_PAINTGUN, &g_Paint_State, sizeof(int));
}

2
project/paint_robot_new/paint_robot_new_motors.c

@ -83,6 +83,7 @@ static void Motor_ModuleHandler(const Msg_t *pstMsg)
}
if (0 == iVehicleMove && 1 == g_iLastVehicleMove)
{
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_SET_STOP_OFF_PAINT, NULL, 0);
MsgCenter_SendTo(MODULE_NAME_CUSTOM, COMMON_CMD_STOP_ALL, NULL, 0);//先关枪
}
g_iLastVehicleMove = iVehicleMove;
@ -104,6 +105,7 @@ static void Motor_ModuleHandler(const Msg_t *pstMsg)
iVehicleMove = 0;
if (1 == g_iLastVehicleMove)
{
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_SET_STOP_OFF_PAINT, NULL, 0);
MsgCenter_SendTo(MODULE_NAME_CUSTOM, COMMON_CMD_STOP_ALL, NULL, 0);//先关枪
}
g_iLastVehicleMove = 0;

Loading…
Cancel
Save