Add missing conditionals for raise-to-wake

This commit is contained in:
Peter Cai 2022-06-15 15:26:27 -04:00
parent d3846be32d
commit 04380f9362

View file

@ -24,12 +24,13 @@ import widgets
from apps.launcher import LauncherApp from apps.launcher import LauncherApp
from apps.pager import PagerApp, CrashApp, NotificationApp from apps.pager import PagerApp, CrashApp, NotificationApp
from micropython import const
RAISE_WAKE_Y_SWITCH_THRESHOLD = -1536 RAISE_WAKE_Y_SWITCH_THRESHOLD = const(-768)
RAISE_WAKE_SPEED_MODIFIER = 8 RAISE_WAKE_SPEED_MODIFIER = const(8)
RAISE_WAKE_X_THRESHOLD = 512 RAISE_WAKE_X_THRESHOLD = const(512)
RAISE_WAKE_Y_THRESHOLD = 0 RAISE_WAKE_Y_THRESHOLD = const(0)
RAISE_WAKE_REQUIRED_SPEED = 512 RAISE_WAKE_REQUIRED_SPEED = const(256)
class EventType(): class EventType():
"""Enumerated interface actions. """Enumerated interface actions.
@ -519,6 +520,9 @@ class Manager():
self.raise_wake_last_y = y self.raise_wake_last_y = y
self.raise_wake_last_z = z 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: if y < RAISE_WAKE_Y_SWITCH_THRESHOLD:
return delta_z > RAISE_WAKE_REQUIRED_SPEED return delta_z > RAISE_WAKE_REQUIRED_SPEED