From 5c4706536acaa86e8fa49e58b6e1e7b8cd21026a Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 31 Jul 2020 20:10:07 -0600 Subject: 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) --- spaghetti-monster/fsm-standby.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'spaghetti-monster/fsm-standby.h') 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 -- cgit v1.2.3