Skip to content

Commit

Permalink
Addressed PR comments
Browse files Browse the repository at this point in the history
Updated API Migration Notes
Changed Axis error that is thrown for over temp from ERROR_OVER_TEMP to ERROR_MOTOR_FAILED
Moved setting of thermistor_.motor_ = this from motor apply_config() to motor constructor
Moved motor_thermistor apply_config call from Motor to config_apply_all() in main.cpp
  • Loading branch information
PAJohnson committed Oct 21, 2020
1 parent 250831b commit fd848f2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Please add a note of your changes below this heading if you make a Pull Request.

### API Migration Notes

* `odrive.axis.fet_thermistor`, `odrive.axis.motor_thermistor` moved to `odrive.axis.motor` object
* `enable_uart` and `uart_baudrate` were renamed to `enable_uart0` and `uart0_baudrate`.
* `enable_i2c_instead_of_can` was replaced by the separate settings `enable_i2c0` and `enable_can0`.
* `<axis>.motor.gate_driver` was moved to `<axis>.gate_driver`.
Expand Down
1 change: 1 addition & 0 deletions Firmware/MotorControl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ static bool config_apply_all() {
&& axes[i].min_endstop_.apply_config()
&& axes[i].max_endstop_.apply_config()
&& motors[i].apply_config()
&& motors[i].motor_thermistor_.apply_config()
&& axes[i].apply_config();
}
return success;
Expand Down
9 changes: 4 additions & 5 deletions Firmware/MotorControl/motor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Motor::Motor(TIM_HandleTypeDef* timer,
fet_thermistor_(fet_thermistor),
motor_thermistor_(motor_thermistor) {
apply_config();
fet_thermistor_.motor_ = this;
motor_thermistor_.motor_ = this;
}

// @brief Arms the PWM outputs that belong to this motor.
Expand Down Expand Up @@ -70,9 +72,6 @@ bool Motor::apply_config() {
config_.parent = this;
is_calibrated_ = config_.pre_calibrated;
update_current_controller_gains();
fet_thermistor_.motor_ = this;
motor_thermistor_.motor_ = this;
motor_thermistor_.apply_config();
return true;
}

Expand Down Expand Up @@ -118,12 +117,12 @@ bool Motor::do_checks() {
return false;
}
if (!motor_thermistor_.do_checks()) {
axis_->error_ |= Axis::ERROR_OVER_TEMP;
axis_->error_ |= Axis::ERROR_MOTOR_FAILED;
set_error(ERROR_MOTOR_THERMISTOR_OVER_TEMP);
return false;
}
if (!fet_thermistor_.do_checks()) {
axis_->error_ |= Axis::ERROR_OVER_TEMP;
axis_->error_ |= Axis::ERROR_MOTOR_FAILED;
set_error(ERROR_FET_THERMISTOR_OVER_TEMP);
return false;
}
Expand Down
1 change: 1 addition & 0 deletions Firmware/odrive-interface.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ interfaces:
bit: 17
doc: the min endstop was not enabled during homing
OverTemp:
# unused
doc: Check `motor.error` for more details.
step_dir_active: readonly bool
current_state: readonly AxisState
Expand Down

0 comments on commit fd848f2

Please sign in to comment.