diff --git a/software/src/main.py b/software/src/main.py index 768ead1..613ff97 100644 --- a/software/src/main.py +++ b/software/src/main.py @@ -53,6 +53,13 @@ def setup_wifi(): print(f"ifconfig: {wlan.ifconfig()}") +async def wdt_task(wdt): + # TODO: more checking of app health + # Right now this only protects against the asyncio executor crashing completely + while True: + await asyncio.sleep_ms(500) + wdt.feed() + DB_PATH = '/sd/tonberry.db' config = Configuration() @@ -97,8 +104,10 @@ def run(): start_webserver(config, the_app) # Start + wdt = machine.WDT(timeout=1000) asyncio.create_task(aiorepl.task({'timer_manager': TimerManager(), 'app': the_app})) + asyncio.create_task(wdt_task(wdt)) asyncio.get_event_loop().run_forever()