1
0
mirror of https://github.com/gryf/pywmtemp.git synced 2025-12-19 12:18:02 +01:00

Refresh dockapp every 10ms, update it every second.

This commit is contained in:
2022-05-01 15:16:23 +02:00
parent a7bfd3207c
commit 31b7272e68

View File

@@ -146,21 +146,21 @@ class SensorDockApp(wmdocklib.DockApp):
def main_loop(self): def main_loop(self):
count = 0
while True: while True:
self.check_for_events() self.check_for_events()
position = 1 position = 1
for item in self.conf['readings']: if count == 0:
self.add_string(self.get_reading(item), 1, position) for item in self.conf['readings']:
position += self.char_height self.add_string(self.get_reading(item), 1, position)
while position < self.max_rows * self.char_height: position += self.char_height
self.add_string(' ' * self.max_chars_in_line, 1, position)
position += self.char_height count += 1
pywmgeneral.put_pixel(32, 32, int('ffff88', 16)) if count >= 10:
pywmgeneral.put_pixel(33, 33, int('ffff88', 16)) count = 0
pywmgeneral.put_pixel(32, 33, int('ffff88', 16))
pywmgeneral.put_pixel(33, 32, int('ffff88', 16))
self.redraw() self.redraw()
time.sleep(0.5) time.sleep(0.1)
def get_reading(self, item): def get_reading(self, item):
if 'fname' not in item: if 'fname' not in item: