diff options
| author | Selene ToyKeeper | 2017-09-24 21:08:51 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2017-09-24 21:08:51 -0600 |
| commit | 36fc1e22964795922370008adda1b9a1732905a8 (patch) | |
| tree | 36df23e8ffa16abbf8eab0af3dfff072e3f6e2c6 | |
| parent | Removed unused code from first idle_mode(); experiment. (diff) | |
| download | anduril-36fc1e22964795922370008adda1b9a1732905a8.tar.gz anduril-36fc1e22964795922370008adda1b9a1732905a8.tar.bz2 anduril-36fc1e22964795922370008adda1b9a1732905a8.zip | |
Added idle to goodnight mode, for 2mA less power at all levels.
Reduced ROM size slightly by avoiding repeated access to the volatile current_state var.
| -rw-r--r-- | spaghetti-monster/anduril/anduril.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index b7c4421..8784bc5 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -945,13 +945,18 @@ void setup() { void loop() { + StatePtr state = current_state; + + if (0) {} + #ifdef USE_IDLE_MODE - if (current_state == steady_state) { + else if ((state == steady_state) + || (state == goodnight_state)) { idle_mode(); - } else + } #endif - if (current_state == strobe_state) { + else if (state == strobe_state) { // party / tactical strobe if (strobe_type < 2) { set_level(MAX_LEVEL); @@ -1025,17 +1030,17 @@ void loop() { } #ifdef USE_BATTCHECK - else if (current_state == battcheck_state) { + else if (state == battcheck_state) { battcheck(); } - else if (current_state == tempcheck_state) { + else if (state == tempcheck_state) { blink_num(temperature>>2); nice_delay_ms(1000); } // TODO: blink out therm_ceil during thermal_config_state #endif - else if (current_state == beacon_state) { + else if (state == beacon_state) { set_level(memorized_level); if (! nice_delay_ms(500)) return; set_level(0); |
