emfcamp / TiDAL-Firmware

26 stars 14 forks source link

Refactor apps to be fully event-driven in their button handling #31

Closed tomsci closed 2 years ago

tomsci commented 2 years ago

Apps are now single-inheritance because micropython doesn't support multiple inheritance initialisers (plus it's a bit simpler for app writers).

All apps (except ones that need to synchronously poll for response in a low tech fashion, like otaupdate) now use callbacks for button press events, and own a Buttons object (self.buttons) set up in the App constructor. Apps which require USB or WiFi need to set get_scheduler().sleep_enabled = False to prevent lightsleep from being entered.

MatthewWilkes commented 2 years ago

Love this!