]> mj.ucw.cz Git - ursary.git/commitdiff
Lights: Better handling of long-press-to-max
authorMartin Mares <mj@ucw.cz>
Wed, 6 May 2020 20:41:35 +0000 (22:41 +0200)
committerMartin Mares <mj@ucw.cz>
Wed, 6 May 2020 20:41:35 +0000 (22:41 +0200)
ursaryd.c

index 444149620bf9c401ef032ad66d09647987c050b1..f9ce3b9dcc63e94fa2b9e2aedbf5efad492afa34 100644 (file)
--- a/ursaryd.c
+++ b/ursaryd.c
@@ -562,13 +562,13 @@ static void update_lights_from_button(int ch, int on)
   }};
 
   if (on)
+    timer_add_rel(&lights_button_timer[ch], 500);
+  else if (timer_is_active(&lights_button_timer[ch]))
     {
+      timer_del(&lights_button_timer[ch]);
       lights_on[ch] = !lights_on[ch];
       update_lights();
-      timer_add_rel(&lights_button_timer[ch], 1000);
     }
-  else
-    timer_del(&lights_button_timer[ch]);
 }
 
 /*** Main update routines ***/