Skip to content
Snippets Groups Projects
Commit 018f911b authored by markus's avatar markus
Browse files

Fix button_pressed

parent d9b5e26a
Branches
No related tags found
No related merge requests found
......@@ -158,22 +158,20 @@ class Clock:
colored = False
try:
with display.open() as disp:
button_pressed = False
while True:
self.updateClock(disp)
if self.run_once:
break
# check for button presses
v = buttons.read(buttons.BOTTOM_LEFT | buttons.BOTTOM_RIGHT)
if v == 0:
button_pressed = False
v = buttons.read(buttons.BOTTOM_LEFT | buttons.BOTTOM_RIGHT | buttons.TOP_RIGHT)
button_pressed = v != 0
if not button_pressed and v & buttons.BOTTOM_LEFT != 0:
if button_pressed and v & buttons.BOTTOM_LEFT != 0:
button_pressed = True
self.setTheme(self.theme - 1)
self.writeConfig()
elif not button_pressed and v & buttons.BOTTOM_RIGHT != 0:
elif button_pressed and v & buttons.BOTTOM_RIGHT != 0:
button_pressed = True
self.setTheme(self.theme + 1)
self.writeConfig()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment