summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-09-16 20:47:22 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-09-16 20:47:22 (GMT)
commit889115f4b081428ebfcf0f71c7ab405fb22c2527 (patch)
tree124891e82c7dd40f39a4f8e9691795712c120f0b
parentfa1515487d239d995f5b524fb01f9c820fcaa66b (diff)
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>
-rw-r--r--wasp/wasp.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/wasp/wasp.py b/wasp/wasp.py
index d809457..15bcc21 100644
--- a/wasp/wasp.py
+++ b/wasp/wasp.py
@@ -115,13 +115,19 @@ class Manager():
self._scheduling = False
# TODO: Eventually these should move to main.py
- self.register(ClockApp(), True)
- self.register(StepCounterApp(), True)
- self.register(StopwatchApp(), True)
- self.register(HeartApp(), True)
- self.register(FlashlightApp(), False)
- self.register(SettingsApp(), False)
- self.register(TestApp(), False)
+ for app, qr in ( (ClockApp, True),
+ (StepCounterApp, True),
+ (StopwatchApp, True),
+ (HeartApp, True),
+ (FlashlightApp, False),
+ (SettingsApp, 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):
"""Register an application with the system.