From 9486899f4eaaf06098602a8d557e466092ad1fb7 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Wed, 21 Jun 2023 19:06:30 -0400 Subject: [PATCH] wasp: Allow for clearing a tick request There currently appears to be no way to remove a tick request, and calling this func without args gives: self.tick_expiry = watch.rtc.get_uptime_ms() + period_ms ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ TypeError: unsupported operand type(s) for +: 'int' and 'NoneType' Signed-off-by: Kyle Evans --- wasp/wasp.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wasp/wasp.py b/wasp/wasp.py index a5777f5..0813720 100644 --- a/wasp/wasp.py +++ b/wasp/wasp.py @@ -374,8 +374,12 @@ class Manager(): Note: With the current simplistic timer implementation sub-second tick intervals are not possible. """ - self.tick_period_ms = period_ms - self.tick_expiry = watch.rtc.get_uptime_ms() + period_ms + if period_ms: + self.tick_period_ms = period_ms + self.tick_expiry = watch.rtc.get_uptime_ms() + period_ms + else: + self.tick_period_ms = 0 + self.tick_expiry = None def keep_awake(self): """Reset the keep awake timer."""