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 c3cdc52..4f7a5ce 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) {