diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2021-01-15 20:07:09 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2021-01-15 20:07:09 (GMT) |
| commit | f4f7aac7fd0786d1485d030555e25df3697aab55 (patch) | |
| tree | 2c554b9066b58b922fbc41096780a98f241a44ab /wasp | |
| parent | 64d03fcc11434be77a99a6a315f225673da5872a (diff) | |
system: Move free memory capture into the switch method
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp')
| -rw-r--r-- | wasp/wasp.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/wasp/wasp.py b/wasp/wasp.py index a78f5da..36634e6 100644 --- a/wasp/wasp.py +++ b/wasp/wasp.py @@ -208,6 +208,8 @@ class Manager(): def switch(self, app): """Switch to the requested application. """ + global free + if self.app: if 'background' in dir(self.app): try: @@ -226,6 +228,9 @@ class Manager(): watch.display.mute(True) watch.backlight.set(self._brightness) self.sleep_at = watch.rtc.uptime + 90 + if watch.free: + gc.collect() + free = gc.mem_free() # Clear out any configuration from the old application self.event_mask = 0 @@ -462,17 +467,12 @@ class Manager(): normal execution context meaning any exceptions and other problems can be observed interactively via the console. """ - global free - if self._scheduling: print('Watch already running in the background') return if not self.app: self.switch(self.quick_ring[0]) - if watch.free: - gc.collect() - free = gc.mem_free() # Reminder: wasptool uses this string to confirm the device has # been set running again. @@ -520,13 +520,8 @@ class Manager(): def schedule(self, enable=True): """Run the system manager synchronously.""" - global free - if not self.app: self.switch(self.quick_ring[0]) - if watch.free: - gc.collect() - free = gc.mem_free() if enable: watch.schedule = self._schedule |
