Skip to content

Commit bc54b1d

Browse files
authored
fix(motor-control): improve brake delay time (#821)
* delay 100ms instead of 20ms for the brake * this is redundant techincally but is more correct incease we change timing later.
1 parent 2cdc8cf commit bc54b1d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

motor-control/firmware/motor_control_hardware.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ uint16_t motor_hardware_get_stopwatch_pulses(void* stopwatch_handle, uint8_t cle
133133
}
134134

135135
void motor_hardware_delay(uint32_t delay) {
136-
vTaskDelay(delay);
136+
const TickType_t xDelay = delay * portTICK_PERIOD_MS;
137+
vTaskDelay(xDelay);
137138
}
138139

139140

motor-control/firmware/stepper_motor/motor_hardware.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ void MotorHardware::activate_motor() {
1818
gpio::set(pins.enable);
1919
if (pins.ebrake.has_value()) {
2020
// allow time for the motor current to stablize before releasing the
21-
// brake
21+
// brake spec is < 1ms so this is plenty
2222
motor_hardware_delay(20);
2323
gpio::reset(pins.ebrake.value());
24-
motor_hardware_delay(20);
24+
// Brake spec is 50ms to engage/disengage
25+
motor_hardware_delay(100);
2526
}
2627
}
2728
void MotorHardware::deactivate_motor() {
2829
if (pins.ebrake.has_value()) {
2930
gpio::set(pins.ebrake.value());
30-
motor_hardware_delay(20);
31+
// Brake spec is 50ms to engage/disengage
32+
motor_hardware_delay(100);
3133
}
3234
gpio::reset(pins.enable);
3335
}

0 commit comments

Comments
 (0)