From cfedb2eaf4a0d62969ff05307ac40d4f1cdab2d9 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 17 Jun 2018 18:18:38 -0600 Subject: Implemented halfsleep mode. Will probably change it quite a bit though, so I'm checking in changes first. Needs to be "tick during standby" instead of "half sleep". --- spaghetti-monster/fsm-events.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'spaghetti-monster/fsm-events.h') diff --git a/spaghetti-monster/fsm-events.h b/spaghetti-monster/fsm-events.h index 2721303..84e9ea2 100644 --- a/spaghetti-monster/fsm-events.h +++ b/spaghetti-monster/fsm-events.h @@ -64,6 +64,7 @@ static volatile uint16_t ticks_since_last_event = 0; #define A_OVERHEATING 9 #define A_UNDERHEATING 10 #define A_VOLTAGE_LOW 11 +#define A_HALFSLEEP_TICK 12 //#define A_VOLTAGE_CRITICAL 12 #define A_DEBUG 255 // test event for debugging @@ -83,6 +84,11 @@ Event EV_reenter_state[] = { Event EV_tick[] = { A_TICK, 0 } ; +#ifdef USE_HALFSLEEP_MODE +Event EV_halfsleep_tick[] = { + A_HALFSLEEP_TICK, + 0 } ; +#endif #ifdef USE_LVP Event EV_voltage_low[] = { A_VOLTAGE_LOW, -- cgit v1.2.3 From 3dcfc924bf18c48b76f4b950471160436fddb316 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 17 Jun 2018 19:40:38 -0600 Subject: Changed halfsleep mode to TICK_DURING_STANDBY. Added blinking indicator LED support to Anduril. --- spaghetti-monster/fsm-events.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'spaghetti-monster/fsm-events.h') diff --git a/spaghetti-monster/fsm-events.h b/spaghetti-monster/fsm-events.h index 84e9ea2..4a67347 100644 --- a/spaghetti-monster/fsm-events.h +++ b/spaghetti-monster/fsm-events.h @@ -42,10 +42,9 @@ typedef struct Emission { #define EV_MAX_LEN ((MAX_CLICKS*2)+3) uint8_t current_event[EV_MAX_LEN]; // at 0.016 ms per tick, 255 ticks = 4.08 s -// TODO: 16 bits? static volatile uint16_t ticks_since_last_event = 0; -// timeout durations in ticks (each tick 1/60th s) +// timeout durations in ticks (each tick 1/62th s) #ifndef HOLD_TIMEOUT #define HOLD_TIMEOUT 24 #endif @@ -57,15 +56,15 @@ static volatile uint16_t ticks_since_last_event = 0; #define A_LEAVE_STATE 2 #define A_REENTER_STATE 3 #define A_TICK 4 -#define A_PRESS 5 -#define A_HOLD 6 -#define A_RELEASE 7 -#define A_RELEASE_TIMEOUT 8 -#define A_OVERHEATING 9 -#define A_UNDERHEATING 10 -#define A_VOLTAGE_LOW 11 -#define A_HALFSLEEP_TICK 12 -//#define A_VOLTAGE_CRITICAL 12 +#define A_SLEEP_TICK 5 +#define A_PRESS 6 +#define A_HOLD 7 +#define A_RELEASE 8 +#define A_RELEASE_TIMEOUT 9 +#define A_OVERHEATING 10 +#define A_UNDERHEATING 11 +#define A_VOLTAGE_LOW 12 +//#define A_VOLTAGE_CRITICAL 13 #define A_DEBUG 255 // test event for debugging // Event types @@ -84,9 +83,9 @@ Event EV_reenter_state[] = { Event EV_tick[] = { A_TICK, 0 } ; -#ifdef USE_HALFSLEEP_MODE -Event EV_halfsleep_tick[] = { - A_HALFSLEEP_TICK, +#ifdef TICK_DURING_STANDBY +Event EV_sleep_tick[] = { + A_SLEEP_TICK, 0 } ; #endif #ifdef USE_LVP -- cgit v1.2.3 From a59a93326bffc24725f44499415e96c16ea6b541 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 26 Jun 2018 19:49:12 -0600 Subject: Mostly got Emisar UI working... I think. Not yet tested. --- spaghetti-monster/fsm-events.h | 74 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'spaghetti-monster/fsm-events.h') diff --git a/spaghetti-monster/fsm-events.h b/spaghetti-monster/fsm-events.h index 4a67347..0212c2c 100644 --- a/spaghetti-monster/fsm-events.h +++ b/spaghetti-monster/fsm-events.h @@ -68,6 +68,7 @@ static volatile uint16_t ticks_since_last_event = 0; #define A_DEBUG 255 // test event for debugging // Event types +// TODO: make these progmem-only? Event EV_debug[] = { A_DEBUG, 0 } ; @@ -407,9 +408,76 @@ Event EV_click12_complete[] = { A_RELEASE_TIMEOUT, 0 }; #endif +#if MAX_CLICKS >= 13 +#define EV_13clicks EV_click13_complete +Event EV_click13_complete[] = { + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_RELEASE_TIMEOUT, + 0 }; +#endif +#if MAX_CLICKS >= 14 +#define EV_14clicks EV_click14_complete +Event EV_click14_complete[] = { + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_PRESS, + A_RELEASE, + A_RELEASE_TIMEOUT, + 0 }; +#endif // ... and so on // A list of button event types for easy iteration +// TODO: make this progmem-only? EventPtr event_sequences[] = { EV_click1_press, EV_release, @@ -458,6 +526,12 @@ EventPtr event_sequences[] = { #if MAX_CLICKS >= 12 EV_click12_complete, #endif + #if MAX_CLICKS >= 13 + EV_click13_complete, + #endif + #if MAX_CLICKS >= 14 + EV_click14_complete, + #endif // ... }; -- cgit v1.2.3