From 65c269852d9ae936fc8e8183bcbd670ec708cd15 Mon Sep 17 00:00:00 2001 From: "benny.meisels" Date: Fri, 22 May 2020 17:44:19 +0300 Subject: [PATCH] Adjusted badge lib and clock app to support partial refresh --- apps/clock/clock.py | 6 +++--- lib/arambadge.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/clock/clock.py b/apps/clock/clock.py index 0d18530..faa7bda 100644 --- a/apps/clock/clock.py +++ b/apps/clock/clock.py @@ -19,7 +19,7 @@ def __init__(self): self.assets[':'] = self.assets['colon'] def draw_time(self, dt, x, y): - timestr = '%02d:%02d' % (dt.tm_hour, dt.tm_min) + timestr = '%02d:%02d' % (dt.tm_min, dt.tm_sec) group = displayio.Group(max_size=len(timestr), x=x, y=y) xpos = 0 for ch in timestr: @@ -30,9 +30,9 @@ def draw_time(self, dt, x, y): def run(self): display = badge.display + rtc_instance = rtc.RTC() while True: - rtc_instance = rtc.RTC() group = displayio.Group() group.append(Rect(0, 0, display.width, display.height, fill=0xffffff)) group.append(self.draw_time(rtc_instance.datetime, 48, 40)) @@ -40,4 +40,4 @@ def run(self): while display.time_to_refresh > 0: pass display.refresh() - time.sleep(60-time.time()%60) + #time.sleep(1) diff --git a/lib/arambadge.py b/lib/arambadge.py index 0bb0d8d..24bf63d 100644 --- a/lib/arambadge.py +++ b/lib/arambadge.py @@ -139,7 +139,7 @@ def display(self): import adafruit_il0373 displayio.release_displays() self._display = adafruit_il0373.IL0373(self.display_bus, width=296, height=128, rotation=270, - seconds_per_frame=5, busy_pin=board.DISP_BUSY, swap_rams=True) + seconds_per_frame=0.195, busy_pin=board.DISP_BUSY, swap_rams=True) return self._display @property