diff options
| author | Selene ToyKeeper | 2017-09-03 14:58:22 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2017-09-03 14:58:22 -0600 |
| commit | a419850e536f00549120255a627137faffded47a (patch) | |
| tree | 60976f561f189d6e5e08a581bdc3824f163f65be /spaghetti-monster/fsm-states.c | |
| parent | Added UI2. UI2 is weird. (diff) | |
| download | anduril-a419850e536f00549120255a627137faffded47a.tar.gz anduril-a419850e536f00549120255a627137faffded47a.tar.bz2 anduril-a419850e536f00549120255a627137faffded47a.zip | |
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.
Diffstat (limited to 'spaghetti-monster/fsm-states.c')
| -rw-r--r-- | spaghetti-monster/fsm-states.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/spaghetti-monster/fsm-states.c b/spaghetti-monster/fsm-states.c index 2939475..09ae804 100644 --- a/spaghetti-monster/fsm-states.c +++ b/spaghetti-monster/fsm-states.c @@ -67,26 +67,28 @@ StatePtr pop_state() { if (state_stack_len > 0) { new_state = state_stack[state_stack_len-1]; } - // FIXME: what should 'arg' be? + // FIXME: what should 'arg' be? (maybe re-entry should be entry with arg+1?) _set_state(new_state, 0, EV_leave_state, EV_reenter_state); return old_state; } uint8_t set_state(StatePtr new_state, uint16_t arg) { // FIXME: this calls exit/enter hooks it shouldn't + // (for the layer underneath the top) pop_state(); return push_state(new_state, arg); } +#ifndef DONT_USE_DEFAULT_STATE // bottom state on stack // handles default actions for LVP, thermal regulation, etc uint8_t default_state(EventPtr event, uint16_t arg) { - if (0) {} + if (0) {} // this should get compiled out #ifdef USE_LVP else if (event == EV_voltage_low) { low_voltage(); - return 0; + return EVENT_HANDLED; } #endif @@ -105,7 +107,8 @@ uint8_t default_state(EventPtr event, uint16_t arg) { #endif // event not handled - return 1; + return EVENT_NOT_HANDLED; } +#endif #endif |
