Skip to content

Commit

Permalink
Avoiding app failure if can't switch the ZP USB DCDC on
Browse files Browse the repository at this point in the history
  • Loading branch information
CRImier committed Jan 28, 2019
1 parent c9ee249 commit ee7bb58
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/keyboard_fallback/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from zerophone_hw import USB_DCDC

dcdc = USB_DCDC()

class KeyboardFallbackApp(ZeroApp):

Expand Down Expand Up @@ -56,7 +55,11 @@ def process_dm_event(self, event):
self.c.centered_text("USB kb connected")
elif event == "custom_i2c_disconnected":
self.c.centered_text("Keypad not found!")
dcdc.on()
try:
dcdc = USB_DCDC()
dcdc.on()
except:
logger.exception("Can't turn the ZP USB DC-DC on!")
elif event == "looking_for_usb_keyboard":
self.c.centered_text("Keypad not found!", ch=16)
self.c.centered_text("Looking for USB kb")
Expand Down

0 comments on commit ee7bb58

Please sign in to comment.