]> www.fi.muni.cz Git - bike-lights.git/commitdiff
buttons.c: faster brake sensor reaction time
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Fri, 19 Jul 2013 16:28:20 +0000 (18:28 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Fri, 19 Jul 2013 16:28:20 +0000 (18:28 +0200)
If the ADC reads as "brake on" for two jiffies (1/8 of second),
consider it being on. Previously the interval was too long (1/4 s).

firmware/buttons.c

index c3cdc52703bdb10b108aa59905beaf886dfc84ec..4f7a5ceb184f2d804c50ac76c74e547ca6bbd556 100644 (file)
@@ -235,7 +235,7 @@ static void handle_brake(unsigned char cur, unsigned char prev)
                                              // --- no change ---
        duration = jiffies - button_start[2];
 
-       if (duration <= 3)
+       if (duration == 0) // at least two jiffies
                return;
 
        if (cur) {