From 31b7272e68f40060387a475a158634cce415ac62 Mon Sep 17 00:00:00 2001 From: gryf Date: Sun, 1 May 2022 15:16:23 +0200 Subject: [PATCH] Refresh dockapp every 10ms, update it every second. --- pywmtemp.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pywmtemp.py b/pywmtemp.py index c3fe560..1edf12a 100755 --- a/pywmtemp.py +++ b/pywmtemp.py @@ -146,21 +146,21 @@ class SensorDockApp(wmdocklib.DockApp): def main_loop(self): + count = 0 while True: self.check_for_events() + position = 1 - for item in self.conf['readings']: - self.add_string(self.get_reading(item), 1, position) - position += self.char_height - while position < self.max_rows * self.char_height: - self.add_string(' ' * self.max_chars_in_line, 1, position) - position += self.char_height - pywmgeneral.put_pixel(32, 32, int('ffff88', 16)) - pywmgeneral.put_pixel(33, 33, int('ffff88', 16)) - pywmgeneral.put_pixel(32, 33, int('ffff88', 16)) - pywmgeneral.put_pixel(33, 32, int('ffff88', 16)) + if count == 0: + for item in self.conf['readings']: + self.add_string(self.get_reading(item), 1, position) + position += self.char_height + + count += 1 + if count >= 10: + count = 0 self.redraw() - time.sleep(0.5) + time.sleep(0.1) def get_reading(self, item): if 'fname' not in item: