From e98eae080e70b5fd77106393da9c466acdc91b48 Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Mon, 7 Sep 2026 17:13:42 +0800 Subject: [PATCH] =?UTF-8?q?paint=5Frobot=5Fnew=20v1.1=20build=20[Sep=20=20?= =?UTF-8?q?7=202026=2017:12:12]=20by=20BINGOOPRO=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=96=B7=E6=9E=AA=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RBcore/include/BHBF.h | 1 + project/paint_robot_new/paint_robot_new.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/RBcore/include/BHBF.h b/RBcore/include/BHBF.h index 205e79a..c97ad1a 100644 --- a/RBcore/include/BHBF.h +++ b/RBcore/include/BHBF.h @@ -95,6 +95,7 @@ typedef enum { CUSTOM_GET_PV, // 获取PV CUSTOM_SET_IV, // 设置IV CUSTOM_GET_MK32, // 获取MK32 + CUSTOM_CMD_PAINTGUN, // 控制喷枪 CUSTOM_CMD_END = 0x0300, } Motor_Cmd_e; diff --git a/project/paint_robot_new/paint_robot_new.c b/project/paint_robot_new/paint_robot_new.c index 4a95813..7bd4188 100644 --- a/project/paint_robot_new/paint_robot_new.c +++ b/project/paint_robot_new/paint_robot_new.c @@ -75,6 +75,16 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) } break; } + case CUSTOM_CMD_PAINTGUN: + { + int paintstate = -1; + if (pstMsg->m_uiDataLen >= sizeof(paintstate)) + { + RD_MEMCPY(&paintstate, pstMsg->m_aucData, sizeof(paintstate)); + HAL_GPIO_WritePin(OUT_1_GPIO_Port, OUT_1_Pin, paintstate); + } + break; + } case CUSTOM_GET_MK32: { if (pstMsg->m_uiDataLen >= sizeof(g_stMK32)) @@ -91,6 +101,17 @@ 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 (g_stMK32.CH6_SC == -1000) + { + int paintstate = 0; + MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_CMD_PAINTGUN, &paintstate, sizeof(int)); + } + else + { + int paintstate = 1; + MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_CMD_PAINTGUN, &paintstate, sizeof(int)); + } + if (abs(g_stMK32.CH2_LY_V) <= g_stCV.Joy_Sticker_Value_Allowance && abs(g_stMK32.CH3_LY_H) <= g_stCV.Joy_Sticker_Value_Allowance) { MsgCenter_SendTo(MODULE_NAME_RBCORE, CMD_STOP_ALL, NULL, 0);