From 244c4ced382cbed515b7f331e92830ee257d2790 Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Wed, 11 Oct 2023 01:13:59 +0200 Subject: [PATCH] Remove try catch --- src/matrixclock.py | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/src/matrixclock.py b/src/matrixclock.py index 9f7c767..d85c2d4 100644 --- a/src/matrixclock.py +++ b/src/matrixclock.py @@ -107,33 +107,25 @@ def exitClock (): -try: - serial=spi(port=0, device=0, gpio=noop()) - device=max7219(serial, width=32, height=8, rotate=2, block_orientation=-90) +serial=spi(port=0, device=0, gpio=noop()) +device=max7219(serial, width=32, height=8, rotate=2, block_orientation=-90) - device.contrast(stdContrast) +device.contrast(stdContrast) - while True: - #while getMsgInc(): - # time.sleep(1) +while True: + #while getMsgInc(): + # time.sleep(1) - if timeInNightRange(): - printDark() - now = datetime.now() - timeUntilMorning = 6 - now.hour - (3600 - 60*now.minute - now.second) - time.sleep(timeUntilMorning) + if timeInNightRange(): + printDark() + now = datetime.now() + timeUntilMorning = 6 - now.hour - (3600 - 60*now.minute - now.second) + time.sleep(timeUntilMorning) - printClock() + printClock() - #if getDirectmessengerState() == False : - # initializeDirectmessenger() + #if getDirectmessengerState() == False : + # initializeDirectmessenger() - timeUntilNextMinute = 60 - datetime.now().second - time.sleep(timeUntilNextMinute) -except KeyboardInterrupt: - print("Matrixclock shuts down, because of ^C") - exitClock() - exit() -except BaseException: - exitClock() - exit() + timeUntilNextMinute = 60 - datetime.now().second + time.sleep(timeUntilNextMinute)