From 775edf467ff04365c39786ff97f6acb281ac83af Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Fri, 21 Aug 2026 14:01:47 +0800 Subject: [PATCH] =?UTF-8?q?paint=5Frobot=5Fnew=20v1.0=E3=80=90=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E9=80=9A=E8=BF=87=E3=80=91=E9=80=9F=E5=BA=A6=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E6=94=B9=E4=B8=BA=E7=9B=B4=E6=8E=A5=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=95=B0=E5=AD=97=E8=80=8C=E4=B8=8D=E6=98=AF=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/paint_robot_new/paint_robot_new.c | 4 ---- .../paint_robot_new/paint_robot_new_motors.c | 24 ++++++------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/project/paint_robot_new/paint_robot_new.c b/project/paint_robot_new/paint_robot_new.c index c603520..1cff1e8 100644 --- a/project/paint_robot_new/paint_robot_new.c +++ b/project/paint_robot_new/paint_robot_new.c @@ -61,10 +61,6 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) case CUSTOM_GET_PV: { //log_i("RBCORE_CMD_STOP_ALL"); - Motor_CmdData_t tMotor_CmdData_t = {0}; - tMotor_CmdData_t.m_ucMotorIndex = 1; - tMotor_CmdData_t.m_iValue = (int32_t)pstMsg->m_aucData; - MsgCenter_SendTo(MODULE_NAME_MOTOR, MOTOR_CMD_SET_SPEED, (void *)&tMotor_CmdData_t, sizeof(Motor_CmdData_t)); break; } default: diff --git a/project/paint_robot_new/paint_robot_new_motors.c b/project/paint_robot_new/paint_robot_new_motors.c index a117fb4..11e209f 100644 --- a/project/paint_robot_new/paint_robot_new_motors.c +++ b/project/paint_robot_new/paint_robot_new_motors.c @@ -41,6 +41,7 @@ *----------------------------------------------*/ static Motor_Instance_t *g_apstMotors[MOTOR_INSTANCE_MAX] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; static uint32_t g_uiMotorModuleID = 0; +static int g_aiMotorSpeed[MOTOR_INSTANCE_MAX] = {0}; /*----------------------------------------------* * 常量定义 * @@ -61,14 +62,10 @@ static void Motor_ModuleHandler(const Msg_t *pstMsg) { case MOTOR_CMD_SET_SPEED: { - if (pstMsg->m_uiDataLen >= sizeof(Motor_CmdData_t)) - { - Motor_CmdData_t *pstData = (Motor_CmdData_t *)pstMsg->m_aucData; - if (pstData->m_ucMotorIndex < 2 && g_apstMotors[pstData->m_ucMotorIndex] != NULL) - { - MotorMgr_SetTargetSpeed(g_apstMotors[pstData->m_ucMotorIndex], pstData->m_iValue); - } - } + int iSpeed = (int)pstMsg->m_aucData; + log_i("Set Speed %d", iSpeed); +// g_aiMotorSpeed[0] = iSpeed; +// g_aiMotorSpeed[1] = iSpeed; break; } case MOTOR_CMD_STOP: @@ -84,14 +81,7 @@ static void Motor_ModuleHandler(const Msg_t *pstMsg) } case MOTOR_CMD_SET_HOME: { - if (pstMsg->m_uiDataLen >= sizeof(Motor_CmdData_t)) - { - Motor_CmdData_t *pstData = (Motor_CmdData_t *)pstMsg->m_aucData; - if (pstData->m_ucMotorIndex < 2 && g_apstMotors[pstData->m_ucMotorIndex] != NULL) - { - MotorMgr_SetHome(g_apstMotors[pstData->m_ucMotorIndex]); - } - } + log_i("Not Support [%d]", pstMsg->m_uiMsgID); break; } case MOTOR_CMD_GET_STATUS: @@ -234,7 +224,7 @@ void MotorTask(void *argument) MotorMgr_RequestPosition(g_apstMotors[i]); MotorMgr_RequestFault(g_apstMotors[i]); MotorMgr_RequestVelocity(g_apstMotors[i]); - MotorMgr_SetTargetSpeed(g_apstMotors[i], 50000); + MotorMgr_SetTargetSpeed(g_apstMotors[i], g_aiMotorSpeed[i]); } }