From 759183bac146806295d8aaf6de38a7d321230f1e Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 18 Aug 2020 07:19:32 -0600 Subject: fixed timing of auto-lock function, added SLEEP_TICKS_PER_MINUTE constants --- spaghetti-monster/anduril/off-mode.c | 2 +- spaghetti-monster/fsm-standby.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/spaghetti-monster/anduril/off-mode.c b/spaghetti-monster/anduril/off-mode.c index 9470cfd..5ab1b81 100644 --- a/spaghetti-monster/anduril/off-mode.c +++ b/spaghetti-monster/anduril/off-mode.c @@ -71,7 +71,7 @@ uint8_t off_state(Event event, uint16_t arg) { #ifdef USE_SIMPLE_UI if (! simple_ui_active) { // no auto-lock in Simple UI #endif - uint16_t ticks = autolock_time * SLEEP_TICKS_PER_SECOND * 60; + uint16_t ticks = autolock_time * SLEEP_TICKS_PER_MINUTE; if ((autolock_time > 0) && (arg > ticks)) { set_state(lockout_state, 0); } diff --git a/spaghetti-monster/fsm-standby.h b/spaghetti-monster/fsm-standby.h index 9f411be..b97ef7c 100644 --- a/spaghetti-monster/fsm-standby.h +++ b/spaghetti-monster/fsm-standby.h @@ -45,18 +45,31 @@ volatile uint8_t go_to_standby = 0; * how it is) */ #endif + #if (STANDBY_TICK_SPEED == 1) #define SLEEP_TICKS_PER_SECOND 31 +#define SLEEP_TICKS_PER_MINUTE 1875 + #elif (STANDBY_TICK_SPEED == 2) #define SLEEP_TICKS_PER_SECOND 16 +#define SLEEP_TICKS_PER_MINUTE 938 + #elif (STANDBY_TICK_SPEED == 3) #define SLEEP_TICKS_PER_SECOND 8 +#define SLEEP_TICKS_PER_MINUTE 469 + #elif (STANDBY_TICK_SPEED == 4) #define SLEEP_TICKS_PER_SECOND 4 +#define SLEEP_TICKS_PER_MINUTE 234 + #elif (STANDBY_TICK_SPEED == 5) #define SLEEP_TICKS_PER_SECOND 2 +#define SLEEP_TICKS_PER_MINUTE 117 + #elif (STANDBY_TICK_SPEED == 6) #define SLEEP_TICKS_PER_SECOND 1 +#define SLEEP_TICKS_PER_MINUTE 59 + #endif #endif -- cgit v1.2.3