aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-08-18 07:19:32 -0600
committerSelene ToyKeeper2020-08-18 07:19:32 -0600
commit759183bac146806295d8aaf6de38a7d321230f1e (patch)
treec2f3a9801ffab3ed658c93cd64844fc91a5b0cea
parentshuffled functions around to make 4C lockout and 3C battcheck again (diff)
downloadanduril-759183bac146806295d8aaf6de38a7d321230f1e.tar.gz
anduril-759183bac146806295d8aaf6de38a7d321230f1e.tar.bz2
anduril-759183bac146806295d8aaf6de38a7d321230f1e.zip
fixed timing of auto-lock function, added SLEEP_TICKS_PER_MINUTE constants
-rw-r--r--spaghetti-monster/anduril/off-mode.c2
-rw-r--r--spaghetti-monster/fsm-standby.h13
2 files changed, 14 insertions, 1 deletions
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