1
0
Fork 0

wasp: Allow app initialization to fail

Colmi has released a new revision of the P8 hardware based on a different
accelerometer. That makes it impossible for the StepCounterApp to
initialize and currently this takes down the whole GUI due to the
uncaught exception.

Fix this by skipping applications that will not initialize.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
Daniel Thompson 2020-09-16 21:47:22 +01:00
parent fa1515487d
commit 889115f4b0

View file

@ -115,13 +115,19 @@ class Manager():
self._scheduling = False self._scheduling = False
# TODO: Eventually these should move to main.py # TODO: Eventually these should move to main.py
self.register(ClockApp(), True) for app, qr in ( (ClockApp, True),
self.register(StepCounterApp(), True) (StepCounterApp, True),
self.register(StopwatchApp(), True) (StopwatchApp, True),
self.register(HeartApp(), True) (HeartApp, True),
self.register(FlashlightApp(), False) (FlashlightApp, False),
self.register(SettingsApp(), False) (SettingsApp, False),
self.register(TestApp(), False) (TestApp, False) ):
try:
self.register(app(), qr)
except:
# Let's not bring the whole device down just because there's
# an exception starting one of the apps...
pass
def register(self, app, quick_ring=False): def register(self, app, quick_ring=False):
"""Register an application with the system. """Register an application with the system.