|
|
|
@ -183,6 +183,11 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
case COMMON_CMD_STOP_ALL: |
|
|
|
{ |
|
|
|
HAL_GPIO_WritePin(OUT_1_GPIO_Port, OUT_1_Pin, 1); |
|
|
|
break; |
|
|
|
} |
|
|
|
case CUSTOM_CMD_PAINTGUN: |
|
|
|
{ |
|
|
|
int paintstate = -1; |
|
|
|
@ -218,7 +223,22 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
|
g_stIV.RobotMoveSpeed = iVehicleSpeed; |
|
|
|
MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_GET_VEHICLE_SPEED, (void *)&iVehicleSpeed, sizeof(int)); |
|
|
|
|
|
|
|
// 按键处于默认位置安卓界面可控
|
|
|
|
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) |
|
|
|
&& (g_stMK32.CH4_SA ==0) && (g_stMK32.CH5_SB == 0) |
|
|
|
&& (g_stMK32.CH6_SC != -1000) ) |
|
|
|
{ |
|
|
|
g_stIV.IsWorking = 0; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
g_stIV.IsWorking = 1; |
|
|
|
} |
|
|
|
|
|
|
|
// 开关喷枪
|
|
|
|
if (g_stPV.RunMode == 1) |
|
|
|
{ |
|
|
|
if (g_stMK32.CH6_SC == -1000) |
|
|
|
{ |
|
|
|
int paintstate = 0; |
|
|
|
@ -229,6 +249,20 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
|
int paintstate = 1; |
|
|
|
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_CMD_PAINTGUN, &paintstate, sizeof(int)); |
|
|
|
} |
|
|
|
} |
|
|
|
else if(g_stPV.RunMode == 2 || g_stPV.RunMode == 3) |
|
|
|
{ |
|
|
|
static int CH13_S2_Value = 0; |
|
|
|
if (g_stMK32.CH13_S2 != CH13_S2_Value) |
|
|
|
{ |
|
|
|
if(g_stIV.CurrentSpeed != 0) |
|
|
|
{ |
|
|
|
int paintstate = 0; |
|
|
|
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_CMD_PAINTGUN, &paintstate, sizeof(int)); |
|
|
|
} |
|
|
|
} |
|
|
|
CH13_S2_Value = g_stMK32.CH13_S2; |
|
|
|
} |
|
|
|
|
|
|
|
int iTargetAngle = 0; |
|
|
|
// 根据模式判断换道(仅在竖直向左或向右生效)
|
|
|
|
@ -270,13 +304,37 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
|
|
|
|
|
// 自动巡航
|
|
|
|
if (g_stMK32.CH5_SB == -1000) |
|
|
|
{ |
|
|
|
if (g_stPV.RunMode == 1) |
|
|
|
{ |
|
|
|
MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_MANUAL_FORWARD, NULL, 0); |
|
|
|
} |
|
|
|
else if (g_stPV.RunMode == 2 || g_stPV.RunMode == 3) |
|
|
|
{ |
|
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
|
.m_iMode = 1, |
|
|
|
.m_iAngle = g_stCV.RobotUpAngleValue + g_stPV.Vertical_Calibration, |
|
|
|
.m_iTime = -1 |
|
|
|
}; |
|
|
|
MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
else if(g_stMK32.CH5_SB == 1000) |
|
|
|
{ |
|
|
|
if (g_stPV.RunMode == 1) |
|
|
|
{ |
|
|
|
MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_MANUAL_BACKWARD, NULL, 0); |
|
|
|
} |
|
|
|
else if (g_stPV.RunMode == 2 || g_stPV.RunMode == 3) |
|
|
|
{ |
|
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
|
.m_iMode = -1, |
|
|
|
.m_iAngle = g_stCV.RobotUpAngleValue + g_stPV.Vertical_Calibration, |
|
|
|
.m_iTime = -1 |
|
|
|
}; |
|
|
|
MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
@ -297,7 +355,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
|
{ |
|
|
|
MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_MANUAL_FORWARD, NULL, 0); |
|
|
|
} |
|
|
|
else |
|
|
|
else if (g_stPV.RunMode == 2 || g_stPV.RunMode == 3) |
|
|
|
{ |
|
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
|
.m_iMode = 1, |
|
|
|
@ -313,7 +371,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
|
{ |
|
|
|
MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_MANUAL_BACKWARD, NULL, 0); |
|
|
|
} |
|
|
|
else |
|
|
|
else if (g_stPV.RunMode == 2 || g_stPV.RunMode == 3) |
|
|
|
{ |
|
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
|
.m_iMode = -1, |
|
|
|
|