Browse Source

fix some feite servo motor bug

master
zhaohe 2 years ago
parent
commit
d3696cb389
  1. 3
      components/mini_servo_motor/feite_servo_motor.cpp
  2. 2
      components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp

3
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;

2
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) {

Loading…
Cancel
Save