From 9b1fd1f6885d9173bac6273b4bd9e02273bf1328 Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Tue, 13 Oct 2020 20:40:20 +0200
Subject: [PATCH] fix(g-watch): Don't allow LED debugging by default

The button to turn on the LEDs gets pressed easily, making them waste
battery.
---
 preload/apps/g_watch/__init__.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/preload/apps/g_watch/__init__.py b/preload/apps/g_watch/__init__.py
index eae7bb6e..9ff50df8 100644
--- a/preload/apps/g_watch/__init__.py
+++ b/preload/apps/g_watch/__init__.py
@@ -27,6 +27,8 @@ DIGITS = [
 
 DOW = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]
 
+DEBUG_LEDS = False
+
 led_count = 11
 b7 = 255  # brightness of 7-segment display 0...255
 
@@ -153,7 +155,6 @@ with display.open() as disp:
 
     leds.dim_top(2)
     leds_on = 0
-    p_leds_on = 0
 
     while True:
         time.sleep(0.1)
@@ -177,9 +178,8 @@ with display.open() as disp:
 
         # ---------------------------------------- read buttons
         pressed = buttons.read(buttons.BOTTOM_LEFT | buttons.BOTTOM_RIGHT)
-        p_leds_on = leds_on
 
-        if pressed & buttons.BOTTOM_LEFT != 0:
+        if DEBUG_LEDS and pressed & buttons.BOTTOM_LEFT != 0:
             leds_on = 0
             disp.clear()
             disp.print("LEDS OFF", posx=40, posy=30, font=2)
@@ -192,7 +192,7 @@ with display.open() as disp:
             leds.update()
             disp.update()
 
-        if pressed & buttons.BOTTOM_RIGHT != 0:
+        if DEBUG_LEDS and pressed & buttons.BOTTOM_RIGHT != 0:
             leds_on = 1
             disp.clear()
             disp.print("LEDS ON", posx=40, posy=30, font=2)
-- 
GitLab