From 04380f9362b816245def86184060b7363b6b319d Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Wed, 15 Jun 2022 15:26:27 -0400 Subject: [PATCH] Add missing conditionals for raise-to-wake --- wasp/wasp.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/wasp/wasp.py b/wasp/wasp.py index 97eec79..d3a1a8d 100644 --- a/wasp/wasp.py +++ b/wasp/wasp.py @@ -24,12 +24,13 @@ import widgets from apps.launcher import LauncherApp from apps.pager import PagerApp, CrashApp, NotificationApp +from micropython import const -RAISE_WAKE_Y_SWITCH_THRESHOLD = -1536 -RAISE_WAKE_SPEED_MODIFIER = 8 -RAISE_WAKE_X_THRESHOLD = 512 -RAISE_WAKE_Y_THRESHOLD = 0 -RAISE_WAKE_REQUIRED_SPEED = 512 +RAISE_WAKE_Y_SWITCH_THRESHOLD = const(-768) +RAISE_WAKE_SPEED_MODIFIER = const(8) +RAISE_WAKE_X_THRESHOLD = const(512) +RAISE_WAKE_Y_THRESHOLD = const(0) +RAISE_WAKE_REQUIRED_SPEED = const(256) class EventType(): """Enumerated interface actions. @@ -519,6 +520,9 @@ class Manager(): self.raise_wake_last_y = y self.raise_wake_last_z = z + if abs(x) > RAISE_WAKE_X_THRESHOLD or y > RAISE_WAKE_Y_THRESHOLD: + return False + if y < RAISE_WAKE_Y_SWITCH_THRESHOLD: return delta_z > RAISE_WAKE_REQUIRED_SPEED