diff options
| -rw-r--r-- | spaghetti-monster/anduril/load-save-config-fsm.h | 13 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/load-save-config.c | 26 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/off-mode.c | 4 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/ramp-mode.c | 3 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/tint-ramping.h | 4 |
5 files changed, 33 insertions, 17 deletions
diff --git a/spaghetti-monster/anduril/load-save-config-fsm.h b/spaghetti-monster/anduril/load-save-config-fsm.h index 885fb72..9d3dd86 100644 --- a/spaghetti-monster/anduril/load-save-config-fsm.h +++ b/spaghetti-monster/anduril/load-save-config-fsm.h @@ -32,13 +32,16 @@ typedef enum { ramp_discrete_steps_e, #endif #ifdef USE_MANUAL_MEMORY - manual_memory_e, - #ifdef USE_MANUAL_MEMORY_TIMER - manual_memory_timer_e, - #endif + manual_memory_e, + #ifdef USE_MANUAL_MEMORY_TIMER + manual_memory_timer_e, + #endif + #ifdef USE_TINT_RAMPING + manual_memory_tint_e, + #endif #endif #ifdef USE_TINT_RAMPING - tint_e, + tint_e, #endif #ifdef USE_STROBE_STATE strobe_type_e, diff --git a/spaghetti-monster/anduril/load-save-config.c b/spaghetti-monster/anduril/load-save-config.c index 2880c6d..3823521 100644 --- a/spaghetti-monster/anduril/load-save-config.c +++ b/spaghetti-monster/anduril/load-save-config.c @@ -34,13 +34,16 @@ void load_config() { ramp_stepss[1] = eeprom[ramp_discrete_steps_e]; #endif #ifdef USE_MANUAL_MEMORY - manual_memory = eeprom[manual_memory_e]; - #ifdef USE_MANUAL_MEMORY_TIMER - manual_memory_timer = eeprom[manual_memory_timer_e]; - #endif + manual_memory = eeprom[manual_memory_e]; + #ifdef USE_MANUAL_MEMORY_TIMER + manual_memory_timer = eeprom[manual_memory_timer_e]; + #endif + #ifdef USE_TINT_RAMPING + manual_memory_tint = eeprom[manual_memory_tint_e]; + #endif #endif #ifdef USE_TINT_RAMPING - tint = eeprom[tint_e]; + tint = eeprom[tint_e]; #endif #if defined(USE_PARTY_STROBE_MODE) || defined(USE_TACTICAL_STROBE_MODE) strobe_type = eeprom[strobe_type_e]; // TODO: move this to eeprom_wl? @@ -94,13 +97,16 @@ void save_config() { eeprom[ramp_discrete_steps_e] = ramp_stepss[1]; #endif #ifdef USE_MANUAL_MEMORY - eeprom[manual_memory_e] = manual_memory; - #ifdef USE_MANUAL_MEMORY_TIMER - eeprom[manual_memory_timer_e] = manual_memory_timer; - #endif + eeprom[manual_memory_e] = manual_memory; + #ifdef USE_MANUAL_MEMORY_TIMER + eeprom[manual_memory_timer_e] = manual_memory_timer; + #endif + #ifdef USE_TINT_RAMPING + eeprom[manual_memory_tint_e] = manual_memory_tint; + #endif #endif #ifdef USE_TINT_RAMPING - eeprom[tint_e] = tint; + eeprom[tint_e] = tint; #endif #if defined(USE_PARTY_STROBE_MODE) || defined(USE_TACTICAL_STROBE_MODE) eeprom[strobe_type_e] = strobe_type; // TODO: move this to eeprom_wl? diff --git a/spaghetti-monster/anduril/off-mode.c b/spaghetti-monster/anduril/off-mode.c index e37f08d..094cca8 100644 --- a/spaghetti-monster/anduril/off-mode.c +++ b/spaghetti-monster/anduril/off-mode.c @@ -133,8 +133,8 @@ uint8_t off_state(Event event, uint16_t arg) { && (off_time >= (manual_memory_timer * SLEEP_TICKS_PER_MINUTE)) #endif ) { - #if defined(USE_MANUAL_MEMORY_TIMER_FOR_TINT) && defined(USE_TINT_RAMPING) && defined(TINT_RAMP_TOGGLE_ONLY) - tint = 0; + #ifdef USE_TINT_RAMPING + tint = manual_memory_tint; #endif set_level(nearest_level(manual_memory)); } else diff --git a/spaghetti-monster/anduril/ramp-mode.c b/spaghetti-monster/anduril/ramp-mode.c index 9d6eba9..b0a86a0 100644 --- a/spaghetti-monster/anduril/ramp-mode.c +++ b/spaghetti-monster/anduril/ramp-mode.c @@ -393,6 +393,9 @@ uint8_t steady_state(Event event, uint16_t arg) { else if (event == EV_10clicks) { // turn on manual memory and save current brightness manual_memory = actual_level; + #ifdef USE_TINT_RAMPING + manual_memory_tint = tint; // remember tint too + #endif save_config(); blink_once(); return MISCHIEF_MANAGED; diff --git a/spaghetti-monster/anduril/tint-ramping.h b/spaghetti-monster/anduril/tint-ramping.h index bd86659..e482999 100644 --- a/spaghetti-monster/anduril/tint-ramping.h +++ b/spaghetti-monster/anduril/tint-ramping.h @@ -20,6 +20,10 @@ #ifndef TINT_RAMPING_H #define TINT_RAMPING_H +#ifdef USE_MANUAL_MEMORY +uint8_t manual_memory_tint; +#endif + // not actually a mode, more of a fallback under other modes uint8_t tint_ramping_state(Event event, uint16_t arg); |
