From 25b5e1a29064315055475f3f917e47d83571e443 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 11 Mar 2023 11:13:04 +0100 Subject: [PATCH] Move RTC timer set/clear to main function in plant app --- src/apps/plant.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/apps/plant.py b/src/apps/plant.py index 6ea14cc..d009f3d 100644 --- a/src/apps/plant.py +++ b/src/apps/plant.py @@ -151,10 +151,13 @@ def main(): # Call halt in a loop, on battery this switches off power. # On USB, the app will exit when A+C is pressed because the launcher picks that up. while True: + display.rtc.clear_timer_flag() fetch_and_display() + display.rtc.set_timer( + secrets.REFRESH_INTERVAL_MINUTES, ttp=PCF85063A.TIMER_TICK_1_OVER_60HZ + ) print("Halting") display.halt() - display.rtc.clear_timer_flag() def fetch_and_display(): @@ -164,12 +167,10 @@ def fetch_and_display(): display_header("Chargement...") display.set_update_speed(UPDATE_FAST) display.update() + plant = HAPlant() plant.fetch_states() plant.display_state() - display.rtc.set_timer( - secrets.REFRESH_INTERVAL_MINUTES, ttp=PCF85063A.TIMER_TICK_1_OVER_60HZ - ) def display_image():