Skip to content

Commit 36fa2b5

Browse files
authored
Update travis.cea_Digital_Dash.ino
1 parent 434d9f2 commit 36fa2b5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

travis.cea_Digital_Dash.ino

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ volatile uint32_t vssWindowStartUs = 0;
9090
static constexpr uint8_t VSS_MIN_PULSES_TO_MOVE = 6;
9191
static constexpr float VSS_MIN_UNLOCK_KPH = 8.0f; // ~5 mph
9292
static uint8_t vssValidPulseStreak = 0;
93+
static constexpr float VSS_IDLE_RPM_CUTOFF = 1800.0f;
94+
9395

9496

9597

@@ -180,6 +182,7 @@ volatile uint32_t tachPeriodUs = 0;
180182
volatile uint32_t lastTachUs = 0;
181183
volatile uint32_t vssPeriodUs = 0;
182184
volatile uint32_t vssLastUs = 0;
185+
volatile float engineRpm = 0.0f;
183186

184187

185188
float rpmNow = 0.0f;
@@ -495,6 +498,7 @@ void updateRPM() {
495498
rpmFiltered = rpmRaw;
496499

497500
rpmNow = rpmFiltered;
501+
engineRpm = rpmFiltered;
498502
}
499503

500504
// =======================================================
@@ -578,6 +582,14 @@ void updateVSS() {
578582
// NOT MOVING: require sustained evidence to unlock
579583
// --------------------------------
580584
if (!vssMoving) {
585+
586+
// Block idle-correlated VSS chatter (only while trying to unlock)
587+
if (engineRpm < VSS_IDLE_RPM_CUTOFF) {
588+
startGood = 0;
589+
kphNow = 0.0f;
590+
kphEma = 0.0f;
591+
return;
592+
}
581593
// If pulses are not continuous, treat as noise and stay at 0
582594
if ((now - lastPulse) > CONTINUOUS_US) {
583595
startGood = 0;

0 commit comments

Comments
 (0)