diff --git a/project/paint_robot_new/paint_robot_new_motors.c b/project/paint_robot_new/paint_robot_new_motors.c index 3a76e3c..b2bff73 100644 --- a/project/paint_robot_new/paint_robot_new_motors.c +++ b/project/paint_robot_new/paint_robot_new_motors.c @@ -167,17 +167,13 @@ void MotorTask(void *argument) { // 处理消息 MsgCenter_ProcessWait(g_uiMotorModuleID, 2); - - for (int i = 0; i < MOTOR_INSTANCE_MAX; i++) - { - if (g_apstMotors[i] != NULL) - { - // 读取位置、速度、故障 - MotorMgr_RequestPosition(g_apstMotors[i]); - MotorMgr_RequestFault(g_apstMotors[i]); - MotorMgr_RequestVelocity(g_apstMotors[i]); - MotorMgr_SetTargetSpeed(g_apstMotors[i], g_aiMotorSpeed[i]); - } - } + MotorMgr_RequestPosition(g_apstMotors[0]); + MotorMgr_RequestPosition(g_apstMotors[1]); + MotorMgr_RequestFault(g_apstMotors[0]); + MotorMgr_RequestFault(g_apstMotors[1]); + MotorMgr_RequestVelocity(g_apstMotors[0]); + MotorMgr_RequestVelocity(g_apstMotors[1]); + MotorMgr_SetTargetSpeed(g_apstMotors[0], g_aiMotorSpeed[0]); + MotorMgr_SetTargetSpeed(g_apstMotors[1], g_aiMotorSpeed[1]); } }