Fix VSS not resetting to zero (#787)
Reinstated car stop check to avoid speed not going back to zero.
This commit is contained in:
parent
fb0a52bf6f
commit
aea6a6bed4
|
@ -645,8 +645,12 @@ uint16_t getSpeed()
|
||||||
}
|
}
|
||||||
|
|
||||||
pulseTime = vssTotalTime / (VSS_SAMPLES - 1);
|
pulseTime = vssTotalTime / (VSS_SAMPLES - 1);
|
||||||
|
if ( (micros() - vssTimes[0]) > 1000000UL ) { tempSpeed = 0; } // Check that the car hasn't come to a stop
|
||||||
|
else
|
||||||
|
{
|
||||||
tempSpeed = 3600000000UL / (pulseTime * configPage2.vssPulsesPerKm); //Convert the pulse gap into km/h
|
tempSpeed = 3600000000UL / (pulseTime * configPage2.vssPulsesPerKm); //Convert the pulse gap into km/h
|
||||||
tempSpeed = ADC_FILTER(tempSpeed, configPage2.vssSmoothing, currentStatus.vss); //Apply speed smoothing factor
|
tempSpeed = ADC_FILTER(tempSpeed, configPage2.vssSmoothing, currentStatus.vss); //Apply speed smoothing factor
|
||||||
|
}
|
||||||
if(tempSpeed > 1000) { tempSpeed = currentStatus.vss; } //Safety check. This usually occurs when there is a hardware issue
|
if(tempSpeed > 1000) { tempSpeed = currentStatus.vss; } //Safety check. This usually occurs when there is a hardware issue
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue