From d3696cb389eb9dbdc808d961944bcc3a9fbc2a82 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sun, 15 Oct 2023 17:16:18 +0800 Subject: [PATCH] fix some feite servo motor bug --- components/mini_servo_motor/feite_servo_motor.cpp | 3 ++- components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/mini_servo_motor/feite_servo_motor.cpp b/components/mini_servo_motor/feite_servo_motor.cpp index f60b5e4..e4fe23e 100644 --- a/components/mini_servo_motor/feite_servo_motor.cpp +++ b/components/mini_servo_motor/feite_servo_motor.cpp @@ -214,7 +214,7 @@ bool FeiTeServoMotor::reCalibration(int id, int16_t pos) { int16_t nowpos; DO(getNowPos(id, nowpos)); ZLOGI(TAG, "reCalibration id:%d nowpos:%d:%d", id, nowpos, pos); - DO(setTargetPos(id, pos)); + DO(setTargetPos(id, nowpos)); return true; } @@ -355,6 +355,7 @@ bool FeiTeServoMotor::tx_and_rx(uint8_t* tx, uint8_t txdatalen, uint8_t* rx, uin } HAL_UART_DMAStop(m_uart); if (overtime_flag) { + // ZLOGE(TAG, "txandrx overtime"); return false; } return true; diff --git a/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp b/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp index 1a88a4f..2b3cc80 100644 --- a/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp +++ b/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp @@ -40,7 +40,7 @@ int32_t MiniRobotCtrlModule::stop(u8 stop_type) { int32_t MiniRobotCtrlModule::position_calibrate(s32 nowpos) { if (nowpos < 0 || nowpos > 4095) return err::kce_param_out_of_range; if (!m_bus->ping(m_id)) return err::kce_subdevice_overtime; - if (m_bus->reCalibration(m_id, nowpos)) return err::kce_subdevice_overtime; + if (!m_bus->reCalibration(m_id, nowpos)) return err::kce_subdevice_overtime; return 0; } int32_t MiniRobotCtrlModule::rotate(s32 speed, s32 torque, s32 run_time, action_cb_status_t status_cb) {