From b48df32eb1a2f673346377a5a1cfc0ec3246e083 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Tue, 4 Feb 2020 08:49:10 +0000 Subject: [PATCH] wasp: manager: Wake up on a change of charging state --- wasp/manager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wasp/manager.py b/wasp/manager.py index d55df63..2c9ab8c 100644 --- a/wasp/manager.py +++ b/wasp/manager.py @@ -7,6 +7,7 @@ class Manager(object): self.watch = watch self.switch(clock.ClockApp()) self.sleep_at = watch.rtc.uptime + 90 + self.charging = True def switch(self, app): self.app = app @@ -23,13 +24,15 @@ class Manager(object): if self.watch.rtc.uptime > self.sleep_at: self.watch.backlight.set(0) self.watch.display.poweroff() + self.charging = self.watch.battery.charging() self.sleep_at = None gc.collect() else: self.watch.rtc.update() - if self.watch.button.value(): + charging = self.watch.battery.charging() + if self.watch.button.value() or self.charging != charging: self.watch.display.poweron() self.app.update(self.watch) self.watch.backlight.set(2)