Skip to content

Commit

Permalink
New brake current behavior for 6.05 firmware
Browse files Browse the repository at this point in the history
Compatible with 6.02 as well

Signed-off-by: Dado Mista <[email protected]>
  • Loading branch information
surfdado authored and lukash committed Sep 5, 2024
1 parent f6af7d8 commit 25f6320
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,22 @@ static void brake(data *d) {
}

VESC_IF->timeout_reset();
VESC_IF->mc_set_brake_current(d->float_conf.brake_current);

// If brake current is set to 0 don't do anything
if (d->float_conf.brake_current == 0) {
return;
}

// Use brake current over certain ERPM to prevent the board skidding to a stop when deactivated
// at speed?
if (d->motor.abs_erpm > 2000) {
VESC_IF->mc_set_brake_current(d->float_conf.brake_current);
return;
}

// Use DC control mode as it has better holding power
// Also improves with 6.05 shorting feature
VESC_IF->mc_set_duty(0);
}

static void set_current(data *d, float current) {
Expand Down

0 comments on commit 25f6320

Please sign in to comment.