From cfedb2eaf4a0d62969ff05307ac40d4f1cdab2d9 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 17 Jun 2018 18:18:38 -0600 Subject: Implemented halfsleep mode. Will probably change it quite a bit though, so I'm checking in changes first. Needs to be "tick during standby" instead of "half sleep". --- spaghetti-monster/fsm-standby.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'spaghetti-monster/fsm-standby.h') diff --git a/spaghetti-monster/fsm-standby.h b/spaghetti-monster/fsm-standby.h index 0b410fa..bd362a3 100644 --- a/spaghetti-monster/fsm-standby.h +++ b/spaghetti-monster/fsm-standby.h @@ -25,6 +25,11 @@ // set this to nonzero to enter standby mode next time the system is idle volatile uint8_t go_to_standby = 0; +#ifdef USE_HALFSLEEP_MODE +// half-sleep "twilight" mode with WDT on but running slowly +volatile uint8_t halfsleep_mode = 0; +#endif + #define standby_mode sleep_until_eswitch_pressed void sleep_until_eswitch_pressed(); @@ -34,6 +39,4 @@ void sleep_until_eswitch_pressed(); void idle_mode(); #endif -// TODO: half-sleep "twilight" mode with WDT on but running slowly - #endif -- cgit v1.2.3 From 3dcfc924bf18c48b76f4b950471160436fddb316 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 17 Jun 2018 19:40:38 -0600 Subject: Changed halfsleep mode to TICK_DURING_STANDBY. Added blinking indicator LED support to Anduril. --- spaghetti-monster/fsm-standby.h | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'spaghetti-monster/fsm-standby.h') diff --git a/spaghetti-monster/fsm-standby.h b/spaghetti-monster/fsm-standby.h index bd362a3..2cea080 100644 --- a/spaghetti-monster/fsm-standby.h +++ b/spaghetti-monster/fsm-standby.h @@ -25,9 +25,26 @@ // set this to nonzero to enter standby mode next time the system is idle volatile uint8_t go_to_standby = 0; -#ifdef USE_HALFSLEEP_MODE -// half-sleep "twilight" mode with WDT on but running slowly -volatile uint8_t halfsleep_mode = 0; +#ifdef TICK_DURING_STANDBY +#ifndef STANDBY_TICK_SPEED +#define STANDBY_TICK_SPEED 5 // every 0.512 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 + * 6: 1.0 s + * 7: 2.0 s + * 32: 4.0 s + * 33: 8.0 s + * (other values may have unexpected effects; not sure why the final bit is + * separated from the others, in the "32" position instead of "8", but that's + * how it is) + */ +#endif #endif #define standby_mode sleep_until_eswitch_pressed -- cgit v1.2.3