aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-standby.h
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-07-31 20:10:07 -0600
committerSelene ToyKeeper2020-07-31 20:10:07 -0600
commit5c4706536acaa86e8fa49e58b6e1e7b8cd21026a (patch)
tree421b180084beb4db50faaefb8c1417f671a76c06 /spaghetti-monster/fsm-standby.h
parentmade ramping "bump" the sunset timer up a little if it's near the deadline (diff)
downloadanduril-5c4706536acaa86e8fa49e58b6e1e7b8cd21026a.tar.gz
anduril-5c4706536acaa86e8fa49e58b6e1e7b8cd21026a.tar.bz2
anduril-5c4706536acaa86e8fa49e58b6e1e7b8cd21026a.zip
added auto-lock function, mostly contributed by SammysHP
(5C in lockout mode to configure it, 5H to turn it off, similar to UI for manual memory)
Diffstat (limited to 'spaghetti-monster/fsm-standby.h')
-rw-r--r--spaghetti-monster/fsm-standby.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/spaghetti-monster/fsm-standby.h b/spaghetti-monster/fsm-standby.h
index 2cea080..9f411be 100644
--- a/spaghetti-monster/fsm-standby.h
+++ b/spaghetti-monster/fsm-standby.h
@@ -27,15 +27,15 @@ volatile uint8_t go_to_standby = 0;
#ifdef TICK_DURING_STANDBY
#ifndef STANDBY_TICK_SPEED
-#define STANDBY_TICK_SPEED 5 // every 0.512 s
+#define STANDBY_TICK_SPEED 3 // every 0.128 s
/*
* From the Attiny85 manual:
* 0: 16 ms
* 1: 32 ms
* 2: 64 ms
- * 3: 0.125 s
- * 4: 0.25 s
- * 5: 0.5 s
+ * 3: 0.128 s
+ * 4: 0.256 s
+ * 5: 0.512 s
* 6: 1.0 s
* 7: 2.0 s
* 32: 4.0 s
@@ -45,6 +45,19 @@ volatile uint8_t go_to_standby = 0;
* how it is)
*/
#endif
+#if (STANDBY_TICK_SPEED == 1)
+#define SLEEP_TICKS_PER_SECOND 31
+#elif (STANDBY_TICK_SPEED == 2)
+#define SLEEP_TICKS_PER_SECOND 16
+#elif (STANDBY_TICK_SPEED == 3)
+#define SLEEP_TICKS_PER_SECOND 8
+#elif (STANDBY_TICK_SPEED == 4)
+#define SLEEP_TICKS_PER_SECOND 4
+#elif (STANDBY_TICK_SPEED == 5)
+#define SLEEP_TICKS_PER_SECOND 2
+#elif (STANDBY_TICK_SPEED == 6)
+#define SLEEP_TICKS_PER_SECOND 1
+#endif
#endif
#define standby_mode sleep_until_eswitch_pressed