]> www.fi.muni.cz Git - bike-lights.git/blobdiff - firmware/buttons.c
ambient zones adjusted
[bike-lights.git] / firmware / buttons.c
index c1a785d0492c93d9bf91fff728b7e646c3879d9b..2e80142b3be896c0bbf2ffa9961c1b2c48127a58 100644 (file)
@@ -133,8 +133,8 @@ void susp_buttons()
        DDRA &= ~(_BV(PA3) | _BV(PA4)); // set as input
        PORTA |=  _BV(PA3) | _BV(PA4);  // enable internal pull-ups
 
-       GIMSK &= ~_BV(PCIE1); // disable pin-change IRQ on port B
-       GIMSK |= _BV(PCIE0);
+       GIMSK &= ~_BV(PCIE0);
+       GIMSK |= _BV(PCIE1);
 
        PCMSK0 = _BV(PCINT3) | _BV(PCINT4);
                // disable pin-change IRQs on all pins except PA3,PA4
@@ -152,16 +152,16 @@ static void handle_button(unsigned char button, unsigned char cur,
        } else if (!cur && !prev) {           // --- is still pressed ---
                uint16_t duration = jiffies - button_start[button];
 
-               if (duration > 80) {
+               if (duration > 160) {
                        set_status_led(button, on1_pattern);
                                // acknowledge long press
                }
        } else if (cur && !prev) {            // --- just released ---
                uint16_t duration = jiffies - button_start[button];
 
-               if (duration > 6 && duration < 30) {
+               if (duration > 6 && duration < 60) {
                        short_press(button);
-               } else if (duration > 80) {
+               } else if (duration > 160) {
                        set_status_led(button, NULL);
                        long_press(button);
                }