Fix parking sensor bug found by Dan S.

This commit is contained in:
Henrik Ekblad
2015-09-18 21:09:03 +02:00
parent 5c39f022c0
commit 9ed25eb8dc
@@ -137,7 +137,7 @@ void loop() {
numLightPixels--;
} else {
skipZero = 0;
int newLightPixels = NUMPIXELS - (NUMPIXELS*(displayDist-PANIC_DISTANCE)/MAX_DISTANCE);
int newLightPixels = NUMPIXELS - (NUMPIXELS*(displayDist-PANIC_DISTANCE)/(MAX_DISTANCE-PANIC_DISTANCE));
if (newLightPixels>numLightPixels) {
// Fast raise
numLightPixels += max((newLightPixels - numLightPixels) / 2, 1);