Magnifica_S-Pro/firmware/app/main.py

33 lines
840 B
Python

"""
Example application entry point.
Replace this with the Magnifica logic. The launcher provides connectivity,
configuration, activity tracking and OTA in ctx.
"""
try:
import uasyncio as asyncio
except ImportError:
import asyncio
async def setup(ctx):
# Configure GPIOs, state machines, etc. here.
# If this raises immediately after an OTA, boot.py can roll back.
ctx["system"].ready()
async def main(ctx):
activity = ctx["activity"]
uart = ctx["uart"]
while True:
# Example: UART traffic counts as activity.
if uart is not None and uart.any():
activity.touch()
data = uart.read()
if data:
print("[app] UART:", data)
# This local sleep is app responsiveness only; it is NOT OTA polling.
await asyncio.sleep_ms(250)