]> www.fi.muni.cz Git - bike-lights.git/blobdiff - firmware/buttons.c
Common patterns rewrite
[bike-lights.git] / firmware / buttons.c
index 20d28a58915658b84dcfa723d66511743a9cfd46..15c70e28f5b594eb983bc4fbc4b379b7f3aeac0a 100644 (file)
@@ -37,7 +37,7 @@ static uint16_t user_params_starttime;
 
 static void inline set_status_led(unsigned char n, pattern_t *pattern)
 {
-       led_set_pattern(n + N_PWMLEDS, pattern);
+       led_set_pattern(n + 1, pattern);
 }
 
 unsigned char buttons_setup_in_progress()
@@ -111,7 +111,7 @@ static inline void short_press(unsigned char button)
 static inline void long_press(unsigned char button)
 {
        if (button == 0) {
-               power_down();
+               power_down(0);
                return;
        }
 
@@ -171,7 +171,7 @@ static void handle_button(unsigned char button, unsigned char cur,
                uint16_t duration = jiffies - button_start[button];
 
                if (duration >= LONG_PRESS_MIN) {
-                       set_status_led(button, on1_pattern);
+                       set_status_led(button, on_pattern);
                                // acknowledge long press
                }
        } else if (!cur && prev) {            // --- just released ---