diff --git a/Firmware/MotorControl/mechanical_brake.cpp b/Firmware/MotorControl/mechanical_brake.cpp index b70334ff..21a98881 100644 --- a/Firmware/MotorControl/mechanical_brake.cpp +++ b/Firmware/MotorControl/mechanical_brake.cpp @@ -14,13 +14,9 @@ void MechanicalBrake::release() { get_gpio(config_.gpio_num).write(config_.is_active_low ? 1 : 0); } -void MechanicalBrake::set_enabled(bool enable) { - Stm32Gpio gpio = get_gpio(config_.gpio_num); - - // We need this flag to alert the system to the configuration on boot - odrv.config_.gpio_modes[config_.gpio_num] = ODriveIntf::GPIO_MODE_MECH_BRAKE; - +void MechanicalBrake::set_enabled(bool enable) { if (enable) { - gpio.config(GPIO_MODE_OUTPUT_PP, GPIO_NOPULL, GPIO_SPEED_FREQ_LOW); + // We need this flag to alert the system to the configuration on boot + odrv.config_.gpio_modes[config_.gpio_num] = ODriveIntf::GPIO_MODE_MECH_BRAKE; } } \ No newline at end of file diff --git a/docs/mechanical-brakes.md b/docs/mechanical-brakes.md index ae3ce821..3dde1e18 100644 --- a/docs/mechanical-brakes.md +++ b/docs/mechanical-brakes.md @@ -22,12 +22,14 @@ The GPIO pin number, according to the silkscreen labels on ODrive. Set with thes ``` ..mechanical_brake.config.gpio_num = <1, 2, 3, 4, 5, 6, 7, 8> ``` +After GPIO pin number is changed, you'll need to run `.save_configuration()` and `.reboot()` for changes to take effect. ### enabled Enables/disables the operation of the mechanical brake. ``` ..mechanical_brake.config.enabled = ``` +After mechanical brake is enabled or disabled, you'll need to run `.save_configuration()` and `.reboot()` for changes to take effect. ### is_active_low Most safety braking systems are active low, e.g. when the power is off, the brake is on. If the system uses brake drive electronics which use active high logic, flip this bit then reconsider the safety implications of your design...