Skip to content

Commit 9b6ebd6

Browse files
surfdadolukash
authored andcommitted
Simple-start improvements
Simple-start now includes a 1 second grace period before heel lifts get detected. Also the cool-down period after dismounting has been reduced to 2 seconds. Feature: More tolerant simple-start implementation with 1 second grace period
1 parent 013ae41 commit 9b6ebd6

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/main.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ typedef struct {
148148
float turntilt_target, turntilt_interpolated;
149149
float current_time;
150150
float dt;
151-
float disengage_timer, nag_timer;
151+
float engage_timer, disengage_timer, nag_timer;
152152
float idle_voltage;
153153
float fault_angle_pitch_timer, fault_angle_roll_timer, fault_switch_timer,
154154
fault_switch_half_timer;
@@ -410,6 +410,9 @@ static void reset_runtime_vars(data *d) {
410410
d->last_yaw_angle = 0;
411411
d->yaw_aggregate = 0;
412412

413+
// Reset engage_timer (keeps track of how long the board has been engaged/riding)
414+
d->engage_timer = d->current_time;
415+
413416
// RC Move:
414417
d->rc_steps = 0;
415418
d->rc_current = 0;
@@ -509,9 +512,11 @@ bool can_engage(const data *d) {
509512
}
510513

511514
if (d->footpad_sensor.state == FS_LEFT || d->footpad_sensor.state == FS_RIGHT) {
512-
// 5 seconds after stopping we allow starting with a single sensor (e.g. for jump starts)
513-
bool is_simple_start =
514-
d->float_conf.startup_simplestart_enabled && (d->current_time - d->disengage_timer > 5);
515+
// When simple start is enabled:
516+
// 2 seconds after stopping we allow starting with a single sensor (e.g. for jump starts)
517+
// Then up to 1 second after engaging only a single sensor is required even at low speed
518+
bool is_simple_start = d->float_conf.startup_simplestart_enabled &&
519+
((d->current_time - d->disengage_timer > 2) || (d->current_time - d->engage_timer < 1));
515520

516521
if (d->float_conf.fault_is_dual_switch || is_simple_start) {
517522
return true;

0 commit comments

Comments
 (0)