~arthofer-thomas/flashlight-firmware/ramp-table

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/fsm-states.c

  • Committer: Selene Scriven
  • Date: 2018-11-11 23:20:36 UTC
  • mfrom: (388.1.8 event-rework)
  • Revision ID: bzr@toykeeper.net-20181111232036-uvhk7fubpcq7tw2r
merged event-rework branch; reduces ROM size by ~700 bytes and simplifies event system

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
// TODO: function to call stacked callbacks until one returns "handled"
33
33
 
34
34
void _set_state(StatePtr new_state, uint16_t arg,
35
 
                EventPtr exit_event, EventPtr enter_event) {
 
35
                Event exit_event, Event enter_event) {
36
36
    // call old state-exit hook (don't use stack)
37
37
    if (current_state != NULL) current_state(exit_event, arg);
38
38
    // set new state
82
82
#ifndef DONT_USE_DEFAULT_STATE
83
83
// bottom state on stack
84
84
// handles default actions for LVP, thermal regulation, etc
85
 
uint8_t default_state(EventPtr event, uint16_t arg) {
 
85
uint8_t default_state(Event event, uint16_t arg) {
86
86
    if (0) {}  // this should get compiled out
87
87
 
88
88
    #ifdef USE_LVP