diff --git a/preload/apps/analog_clock/__init__.py b/preload/apps/analog_clock/__init__.py index c679a82ec20191acec37fa99519f1cb81e52fc71..70940653bb9193fa283d00dbea9172f2d4141f9a 100644 --- a/preload/apps/analog_clock/__init__.py +++ b/preload/apps/analog_clock/__init__.py @@ -1,6 +1,5 @@ # Adapted from https://github.com/muccc/flipdots/blob/master/scripts/clock.py import display -from utime import sleep import utime import math import leds @@ -11,28 +10,6 @@ import os CONFIG_NAME = "clock.json" -class Time: - def __init__(self, start=0): - self.time = start - self.wait_time = 0.95 - - def tick(self): - sleep(self.wait_time) - self.time += 1 - - @property - def second(self): - return self.time % 60 - - @property - def minute(self): - return (self.time / 60) % 60 - - @property - def hour(self): - return (self.time / 3600) % 24 - - class Clock: def __init__( self, @@ -45,22 +22,15 @@ class Clock: second_hand=True, console_out=False, run_once=False, - update_interval=0, ): - self.sizex = sizex - self.sizey = sizey self.radius = radius - self.center = (int(self.sizex / 2), int(self.sizey / 2)) + self.center = (int(sizex / 2), int(sizey / 2)) self.hour_hand = hour_hand self.minute_hand = minute_hand self.second_hand = second_hand self.console_out = console_out - self.update_interval = ( - update_interval if update_interval != 0 else (1 if self.second_hand else 30) - ) self.run_once = run_once self.offsetx = offsetx - self.time = Time() self.theme = 0 self.default_themes = [ { @@ -178,7 +148,6 @@ class Clock: ) def loop(self): - colored = False try: with display.open() as disp: button_pressed = False @@ -275,6 +244,7 @@ class Clock: for x in range(self.radius * 2): line = line + ( "." + # TODO image is unknown! Dead Code if image[(self.center[1] - self.radius) + y][ (self.center[0] - self.radius) + x ]