diff --git a/Firmware/MotorControl/axis.cpp b/Firmware/MotorControl/axis.cpp index 53b9925d..862c027e 100644 --- a/Firmware/MotorControl/axis.cpp +++ b/Firmware/MotorControl/axis.cpp @@ -174,11 +174,11 @@ bool Axis::do_checks() { } } - if (Ibus_sum > board_config.power_supply_max_current) { + if (Ibus_sum > board_config.dc_max_positive_current) { error_ |= ERROR_DC_BUS_OVER_CURRENT; } - if (Ibus_sum < board_config.power_supply_min_current) { - error_ |= ERROR_DC_BUS_UNDER_CURRENT; + if (Ibus_sum < board_config.dc_max_negative_current) { + error_ |= ERROR_DC_BUS_OVER_REGEN_CURRENT; } // Sub-components should use set_error which will propegate to this error_ diff --git a/Firmware/MotorControl/axis.hpp b/Firmware/MotorControl/axis.hpp index c5a87a67..5ccf0c58 100644 --- a/Firmware/MotorControl/axis.hpp +++ b/Firmware/MotorControl/axis.hpp @@ -24,7 +24,7 @@ public: ERROR_MIN_ENDSTOP_PRESSED = 0x1000, ERROR_MAX_ENDSTOP_PRESSED = 0x2000, ERROR_ESTOP_REQUESTED = 0x4000, - ERROR_DC_BUS_UNDER_CURRENT = 0x8000, // too much current pushed into the power supply + ERROR_DC_BUS_OVER_REGEN_CURRENT = 0x8000, // too much current pushed into the power supply ERROR_DC_BUS_OVER_CURRENT = 0x10000, // too much current pulled out of the power supply ERROR_HOMING_WITHOUT_ENDSTOP = 0x20000, // the min endstop was not enabled during homing }; diff --git a/Firmware/MotorControl/odrive_main.h b/Firmware/MotorControl/odrive_main.h index a505b3e1..e11c2a00 100644 --- a/Firmware/MotorControl/odrive_main.h +++ b/Firmware/MotorControl/odrive_main.h @@ -101,8 +101,8 @@ struct BoardConfig_t { //!< The closer the voltage approaches dc_bus_overvoltage_trip_level, //!< the more power is sunk into the resistor. //!< This feature is disabled if dc_bus_overvoltage_trip_level <= nominal_voltage. - float power_supply_max_current = INFINITY; // Max current [A] the power supply can source - float power_supply_min_current = -INFINITY; // Max current [A] the power supply can sink + float dc_max_positive_current = INFINITY; // Max current [A] the power supply can source + float dc_max_negative_current = -INFINITY; // Max current [A] the power supply can sink PWMMapping_t pwm_mappings[GPIO_COUNT]; PWMMapping_t analog_mappings[GPIO_COUNT]; }; diff --git a/Firmware/communication/communication.cpp b/Firmware/communication/communication.cpp index ea52ca87..d2aa1133 100644 --- a/Firmware/communication/communication.cpp +++ b/Firmware/communication/communication.cpp @@ -167,8 +167,8 @@ static inline auto make_obj_tree() { make_protocol_property("enable_ascii_protocol_on_usb", &board_config.enable_ascii_protocol_on_usb), make_protocol_property("dc_bus_undervoltage_trip_level", &board_config.dc_bus_undervoltage_trip_level), make_protocol_property("dc_bus_overvoltage_trip_level", &board_config.dc_bus_overvoltage_trip_level), - make_protocol_property("power_supply_min_current", &board_config.power_supply_min_current), - make_protocol_property("power_supply_max_current", &board_config.power_supply_max_current), + make_protocol_property("dc_max_negative_current", &board_config.dc_max_negative_current), + make_protocol_property("dc_max_positive_current", &board_config.dc_max_positive_current), #if HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR >= 3 make_protocol_object("gpio1_pwm_mapping", make_protocol_definitions(board_config.pwm_mappings[0])), make_protocol_object("gpio2_pwm_mapping", make_protocol_definitions(board_config.pwm_mappings[1])), diff --git a/tools/odrive/enums.py b/tools/odrive/enums.py index 1292e48b..99b21867 100644 --- a/tools/odrive/enums.py +++ b/tools/odrive/enums.py @@ -32,7 +32,7 @@ class errors: ERROR_MIN_ENDSTOP_PRESSED = 0x1000 ERROR_MAX_ENDSTOP_PRESSED = 0x2000 ERROR_ESTOP_REQUESTED = 0x4000 - ERROR_DC_BUS_UNDER_CURRENT = 0x8000 + ERROR_DC_BUS_OVER_REGEN_CURRENT = 0x8000 ERROR_DC_BUS_OVER_CURRENT = 0x10000 ERROR_HOMING_WITHOUT_ENDSTOP = 0x20000