From 73a5a6974a98aa73ab392272b4d69d285c85dee5 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 19 Aug 2017 17:20:46 -0600 Subject: Completely reorganized SpaghettiMonster code into smaller logical pieces: fsm-*.c and fsm-*.h. --- spaghetti-monster/fsm-standby.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 spaghetti-monster/fsm-standby.h (limited to 'spaghetti-monster/fsm-standby.h') diff --git a/spaghetti-monster/fsm-standby.h b/spaghetti-monster/fsm-standby.h new file mode 100644 index 0000000..baeb6af --- /dev/null +++ b/spaghetti-monster/fsm-standby.h @@ -0,0 +1,26 @@ +/* + * fsm-standby.h: standby mode functions for SpaghettiMonster. + * + * Copyright (C) 2017 Selene ToyKeeper + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef FSM_STANDBY_H +#define FSM_STANDBY_H + +#define standby_mode sleep_until_eswitch_pressed +void sleep_until_eswitch_pressed(); + +#endif -- cgit v1.2.3 From a419850e536f00549120255a627137faffded47a Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 3 Sep 2017 14:58:22 -0600 Subject: Got the 4th PWM channel to work, ish. (channel 4 is inverted though) Moved go_to_suspend thing into main() instead of making each UI handle that during loop(). Made default_state() optional. Fixed bug where battcheck and other number readouts could interfere with the state which interrupted them. (they would sometimes turn the LED off after the new state had already started) Updated darkhorse's moon levels to match new ramp on D4 hardware. --- spaghetti-monster/fsm-standby.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spaghetti-monster/fsm-standby.h') diff --git a/spaghetti-monster/fsm-standby.h b/spaghetti-monster/fsm-standby.h index baeb6af..a23bd0c 100644 --- a/spaghetti-monster/fsm-standby.h +++ b/spaghetti-monster/fsm-standby.h @@ -20,7 +20,14 @@ #ifndef FSM_STANDBY_H #define FSM_STANDBY_H +// deferred "off" so we won't suspend in a weird state +// (like... during the middle of a strobe pulse) +// set this to nonzero to enter standby mode next time the system is idle +volatile uint8_t go_to_standby = 0; + #define standby_mode sleep_until_eswitch_pressed void sleep_until_eswitch_pressed(); +// TODO: half-sleep "twilight" mode with WDT on but running slowly + #endif -- cgit v1.2.3 From 520f5cdb983045c5518325f3c3665f59ca85435e Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 24 Sep 2017 20:54:07 -0600 Subject: Added idle_mode() for slightly lower power use without turning off any regular functions. (PWM, ADC, WDT all still enabled; only useful in moon mode) Changed default ceilings in Anduril FW3A config. --- spaghetti-monster/fsm-standby.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spaghetti-monster/fsm-standby.h') diff --git a/spaghetti-monster/fsm-standby.h b/spaghetti-monster/fsm-standby.h index a23bd0c..3a917fd 100644 --- a/spaghetti-monster/fsm-standby.h +++ b/spaghetti-monster/fsm-standby.h @@ -28,6 +28,13 @@ volatile uint8_t go_to_standby = 0; #define standby_mode sleep_until_eswitch_pressed void sleep_until_eswitch_pressed(); +#ifdef USE_IDLE_MODE +// deferred "idle" state trigger +// stops processing until next click or timer tick +//volatile uint8_t go_to_idle = 0; +void idle_mode(); +#endif + // TODO: half-sleep "twilight" mode with WDT on but running slowly #endif -- cgit v1.2.3 From 08082855cbc7aa0a07f9ddfe6daa86e6c96d5b57 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 24 Sep 2017 20:56:52 -0600 Subject: Removed unused code from first idle_mode(); experiment. --- spaghetti-monster/fsm-standby.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'spaghetti-monster/fsm-standby.h') diff --git a/spaghetti-monster/fsm-standby.h b/spaghetti-monster/fsm-standby.h index 3a917fd..0b410fa 100644 --- a/spaghetti-monster/fsm-standby.h +++ b/spaghetti-monster/fsm-standby.h @@ -29,9 +29,8 @@ volatile uint8_t go_to_standby = 0; void sleep_until_eswitch_pressed(); #ifdef USE_IDLE_MODE -// deferred "idle" state trigger // stops processing until next click or timer tick -//volatile uint8_t go_to_idle = 0; +// (I think) void idle_mode(); #endif -- cgit v1.2.3