diff --git a/project/paint_robot_new/paint_robot_new.c b/project/paint_robot_new/paint_robot_new.c index 489db45..117d681 100644 --- a/project/paint_robot_new/paint_robot_new.c +++ b/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)) @@ -359,11 +364,15 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) { if (g_stMK32.CH6_SC == -1000) { - g_Paint_State = 0; - MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_CMD_PAINTGUN, &g_Paint_State, sizeof(int)); + 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)); } diff --git a/project/paint_robot_new/paint_robot_new_motors.c b/project/paint_robot_new/paint_robot_new_motors.c index 740d48c..aca475a 100644 --- a/project/paint_robot_new/paint_robot_new_motors.c +++ b/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;