Skip to content

Commit

Permalink
fix: waiting for the motor to stop before reenabling
Browse files Browse the repository at this point in the history
  • Loading branch information
dzid26 committed May 24, 2024
1 parent a7322f9 commit 00b882d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/controller/ebike_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ static void ebike_control_motor(void)

// check if to enable the motor
if ((!ui8_motor_enabled) &&
(ui16_motor_speed_erps == 0) && // only enable motor if stopped, else something bad can happen due to high currents/regen or similar
(ui16_motor_speed_erps < (ui16_battery_voltage_filtered_x1000 / K_BEMF_X1000)) && // only enable motor if below base speed, else something bad can happen due to high currents/regen or similar
(ui8_adc_battery_current_target) &&
(!ui8_brakes_engaged)) {
ui8_motor_enabled = 1;
Expand Down

0 comments on commit 00b882d

Please sign in to comment.