aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2017-09-24 21:08:51 -0600
committerSelene ToyKeeper2017-09-24 21:08:51 -0600
commit36fc1e22964795922370008adda1b9a1732905a8 (patch)
tree36df23e8ffa16abbf8eab0af3dfff072e3f6e2c6 /spaghetti-monster
parentRemoved unused code from first idle_mode(); experiment. (diff)
downloadanduril-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.
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/anduril.c17
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);
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.