From a0b0a0af03d0c80d15d27ea02c8d3d7209dfdd01 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 31 Aug 2021 13:43:43 -0600 Subject: added runtime config option for smooth ramp speed --- spaghetti-monster/anduril/config-default.h | 3 +++ spaghetti-monster/anduril/load-save-config-fsm.h | 15 +++++++----- spaghetti-monster/anduril/load-save-config.c | 30 ++++++++++++++---------- spaghetti-monster/anduril/ramp-mode.c | 26 ++++++++++++++++++-- spaghetti-monster/anduril/ramp-mode.h | 8 ++++++- 5 files changed, 61 insertions(+), 21 deletions(-) diff --git a/spaghetti-monster/anduril/config-default.h b/spaghetti-monster/anduril/config-default.h index a50be5d..1043253 100644 --- a/spaghetti-monster/anduril/config-default.h +++ b/spaghetti-monster/anduril/config-default.h @@ -68,6 +68,9 @@ // default ramp style: 0 = smooth, 1 = stepped #define RAMP_STYLE 0 +// smooth ramp speed: 1, 2, 3, 4, ... for 1X speed, 1/2, 1/3rd, 1/4th, ... +#define USE_RAMP_SPEED_CONFIG + // short blip when crossing from "click" to "hold" from off // (helps the user hit moon mode exactly, instead of holding too long // or too short) diff --git a/spaghetti-monster/anduril/load-save-config-fsm.h b/spaghetti-monster/anduril/load-save-config-fsm.h index 343c6ff..edd4ed5 100644 --- a/spaghetti-monster/anduril/load-save-config-fsm.h +++ b/spaghetti-monster/anduril/load-save-config-fsm.h @@ -27,10 +27,19 @@ typedef enum { #ifdef USE_RAMP_CONFIG ramp_smooth_floor_e, ramp_smooth_ceil_e, + #ifdef USE_RAMP_SPEED_CONFIG + ramp_speed_e, + #endif ramp_discrete_floor_e, ramp_discrete_ceil_e, ramp_discrete_steps_e, #endif + #ifdef USE_SIMPLE_UI + simple_ui_floor_e, + simple_ui_ceil_e, + simple_ui_steps_e, + simple_ui_active_e, + #endif #ifdef USE_MANUAL_MEMORY manual_memory_e, #ifdef USE_MANUAL_MEMORY_TIMER @@ -59,12 +68,6 @@ typedef enum { #ifdef USE_BEACON_MODE beacon_seconds_e, #endif - #ifdef USE_SIMPLE_UI - simple_ui_active_e, - simple_ui_floor_e, - simple_ui_ceil_e, - simple_ui_steps_e, - #endif #ifdef USE_THERMAL_REGULATION therm_ceil_e, therm_cal_offset_e, diff --git a/spaghetti-monster/anduril/load-save-config.c b/spaghetti-monster/anduril/load-save-config.c index cd29ca5..57638d6 100644 --- a/spaghetti-monster/anduril/load-save-config.c +++ b/spaghetti-monster/anduril/load-save-config.c @@ -29,10 +29,19 @@ void load_config() { #ifdef USE_RAMP_CONFIG ramp_floors[0] = eeprom[ramp_smooth_floor_e]; ramp_ceils[0] = eeprom[ramp_smooth_ceil_e]; + #ifdef USE_RAMP_SPEED_CONFIG + ramp_speed = eeprom[ramp_speed_e]; + #endif ramp_floors[1] = eeprom[ramp_discrete_floor_e]; ramp_ceils[1] = eeprom[ramp_discrete_ceil_e]; ramp_stepss[1] = eeprom[ramp_discrete_steps_e]; #endif + #ifdef USE_SIMPLE_UI + ramp_floors[2] = eeprom[simple_ui_floor_e]; + ramp_ceils[2] = eeprom[simple_ui_ceil_e]; + ramp_stepss[2] = eeprom[simple_ui_steps_e]; + simple_ui_active = eeprom[simple_ui_active_e]; + #endif #ifdef USE_MANUAL_MEMORY manual_memory = eeprom[manual_memory_e]; #ifdef USE_MANUAL_MEMORY_TIMER @@ -59,12 +68,6 @@ void load_config() { #ifdef USE_BEACON_MODE beacon_seconds = eeprom[beacon_seconds_e]; #endif - #ifdef USE_SIMPLE_UI - simple_ui_active = eeprom[simple_ui_active_e]; - ramp_floors[2] = eeprom[simple_ui_floor_e]; - ramp_ceils[2] = eeprom[simple_ui_ceil_e]; - ramp_stepss[2] = eeprom[simple_ui_steps_e]; - #endif #ifdef USE_THERMAL_REGULATION therm_ceil = eeprom[therm_ceil_e]; therm_cal_offset = eeprom[therm_cal_offset_e]; @@ -95,10 +98,19 @@ void save_config() { #ifdef USE_RAMP_CONFIG eeprom[ramp_smooth_floor_e] = ramp_floors[0]; eeprom[ramp_smooth_ceil_e] = ramp_ceils[0]; + #ifdef USE_RAMP_SPEED_CONFIG + eeprom[ramp_speed_e] = ramp_speed; + #endif eeprom[ramp_discrete_floor_e] = ramp_floors[1]; eeprom[ramp_discrete_ceil_e] = ramp_ceils[1]; eeprom[ramp_discrete_steps_e] = ramp_stepss[1]; #endif + #ifdef USE_SIMPLE_UI + eeprom[simple_ui_floor_e] = ramp_floors[2]; + eeprom[simple_ui_ceil_e] = ramp_ceils[2]; + eeprom[simple_ui_steps_e] = ramp_stepss[2]; + eeprom[simple_ui_active_e] = simple_ui_active; + #endif #ifdef USE_MANUAL_MEMORY eeprom[manual_memory_e] = manual_memory; #ifdef USE_MANUAL_MEMORY_TIMER @@ -125,12 +137,6 @@ void save_config() { #ifdef USE_BEACON_MODE eeprom[beacon_seconds_e] = beacon_seconds; #endif - #ifdef USE_SIMPLE_UI - eeprom[simple_ui_active_e] = simple_ui_active; - eeprom[simple_ui_floor_e] = ramp_floors[2]; - eeprom[simple_ui_ceil_e] = ramp_ceils[2]; - eeprom[simple_ui_steps_e] = ramp_stepss[2]; - #endif #ifdef USE_THERMAL_REGULATION eeprom[therm_ceil_e] = therm_ceil; eeprom[therm_cal_offset_e] = therm_cal_offset; diff --git a/spaghetti-monster/anduril/ramp-mode.c b/spaghetti-monster/anduril/ramp-mode.c index e16a7b9..2508d52 100644 --- a/spaghetti-monster/anduril/ramp-mode.c +++ b/spaghetti-monster/anduril/ramp-mode.c @@ -149,6 +149,12 @@ uint8_t steady_state(Event event, uint16_t arg) { if (ramp_style && (arg % HOLD_TIMEOUT != 0)) { return MISCHIEF_MANAGED; } + #ifdef USE_RAMP_SPEED_CONFIG + // ramp slower if user configured things that way + if ((! ramp_style) && (arg % ramp_speed)) { + return MISCHIEF_MANAGED; + } + #endif // fix ramp direction on first frame if necessary if (!arg) { // click, hold should always go down if possible @@ -160,12 +166,24 @@ uint8_t steady_state(Event event, uint16_t arg) { else if (actual_level <= mode_min) { ramp_direction = 1; } } // if the button is stuck, err on the side of safety and ramp down - else if ((arg > TICKS_PER_SECOND * 5) && (actual_level >= mode_max)) { + else if ((arg > TICKS_PER_SECOND * 5 + #ifdef USE_RAMP_SPEED_CONFIG + // FIXME: count from time actual_level hits mode_max, + // not from beginning of button hold + * ramp_speed + #endif + ) && (actual_level >= mode_max)) { ramp_direction = -1; } #ifdef USE_LOCKOUT_MODE // if the button is still stuck, lock the light - else if ((arg > TICKS_PER_SECOND * 10) && (actual_level <= mode_min)) { + else if ((arg > TICKS_PER_SECOND * 10 + #ifdef USE_RAMP_SPEED_CONFIG + // FIXME: count from time actual_level hits mode_min, + // not from beginning of button hold + * ramp_speed + #endif + ) && (actual_level <= mode_min)) { blink_once(); set_state(lockout_state, 0); } @@ -445,7 +463,11 @@ void ramp_config_save(uint8_t step, uint8_t value) { } uint8_t ramp_config_state(Event event, uint16_t arg) { + #ifdef USE_RAMP_SPEED_CONFIG + const uint8_t num_config_steps = 3; + #else uint8_t num_config_steps = ramp_style + 2; + #endif return config_state_base(event, arg, num_config_steps, ramp_config_save); } diff --git a/spaghetti-monster/anduril/ramp-mode.h b/spaghetti-monster/anduril/ramp-mode.h index 7fb704a..7c8b014 100644 --- a/spaghetti-monster/anduril/ramp-mode.h +++ b/spaghetti-monster/anduril/ramp-mode.h @@ -75,6 +75,9 @@ #ifndef RAMP_STYLE #define RAMP_STYLE 0 // smooth default #endif +#ifndef DEFAULT_RAMP_SPEED +#define DEFAULT_RAMP_SPEED 1 // WDT ticks per "frame", must be 1 or more +#endif #ifndef RAMP_SMOOTH_FLOOR #define RAMP_SMOOTH_FLOOR 1 #endif @@ -165,6 +168,9 @@ uint8_t simple_ui_active = SIMPLE_UI_ACTIVE; #endif // smooth vs discrete ramping uint8_t ramp_style = RAMP_STYLE; // 0 = smooth, 1 = discrete +#ifdef USE_RAMP_SPEED_CONFIG +#define ramp_speed (ramp_stepss[0]) +#endif // current values, regardless of style uint8_t ramp_floor = RAMP_SMOOTH_FLOOR; uint8_t ramp_ceil = RAMP_SMOOTH_CEIL; @@ -184,7 +190,7 @@ uint8_t ramp_ceils[] = { #endif }; uint8_t ramp_stepss[] = { - 0, + DEFAULT_RAMP_SPEED, RAMP_DISCRETE_STEPS, #ifdef USE_SIMPLE_UI SIMPLE_UI_STEPS, -- cgit v1.2.3 From bbdce623e3076f6b0f28526fe38771c894d7adfa Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 31 Aug 2021 14:16:38 -0600 Subject: added runtime option to select whether to ramp up after hold-from-off (default) or stay at floor --- spaghetti-monster/anduril/config-default.h | 3 +++ spaghetti-monster/anduril/load-save-config-fsm.h | 3 +++ spaghetti-monster/anduril/load-save-config.c | 6 +++++ spaghetti-monster/anduril/off-mode.c | 5 ++++ spaghetti-monster/anduril/ramp-mode.c | 30 +++++++++++++++++------- spaghetti-monster/anduril/ramp-mode.h | 13 ++++++++-- 6 files changed, 49 insertions(+), 11 deletions(-) diff --git a/spaghetti-monster/anduril/config-default.h b/spaghetti-monster/anduril/config-default.h index 1043253..4beb753 100644 --- a/spaghetti-monster/anduril/config-default.h +++ b/spaghetti-monster/anduril/config-default.h @@ -71,6 +71,9 @@ // smooth ramp speed: 1, 2, 3, 4, ... for 1X speed, 1/2, 1/3rd, 1/4th, ... #define USE_RAMP_SPEED_CONFIG +// add runtime option for whether hold-from-off should ramp or stay at moon +#define USE_RAMP_AFTER_MOON_OPTION + // short blip when crossing from "click" to "hold" from off // (helps the user hit moon mode exactly, instead of holding too long // or too short) diff --git a/spaghetti-monster/anduril/load-save-config-fsm.h b/spaghetti-monster/anduril/load-save-config-fsm.h index edd4ed5..a6d1281 100644 --- a/spaghetti-monster/anduril/load-save-config-fsm.h +++ b/spaghetti-monster/anduril/load-save-config-fsm.h @@ -40,6 +40,9 @@ typedef enum { simple_ui_steps_e, simple_ui_active_e, #endif + #ifdef USE_RAMP_AFTER_MOON_OPTION + dont_ramp_after_moon_e, + #endif #ifdef USE_MANUAL_MEMORY manual_memory_e, #ifdef USE_MANUAL_MEMORY_TIMER diff --git a/spaghetti-monster/anduril/load-save-config.c b/spaghetti-monster/anduril/load-save-config.c index 57638d6..f564187 100644 --- a/spaghetti-monster/anduril/load-save-config.c +++ b/spaghetti-monster/anduril/load-save-config.c @@ -42,6 +42,9 @@ void load_config() { ramp_stepss[2] = eeprom[simple_ui_steps_e]; simple_ui_active = eeprom[simple_ui_active_e]; #endif + #ifdef USE_RAMP_AFTER_MOON_OPTION + dont_ramp_after_moon = eeprom[dont_ramp_after_moon_e]; + #endif #ifdef USE_MANUAL_MEMORY manual_memory = eeprom[manual_memory_e]; #ifdef USE_MANUAL_MEMORY_TIMER @@ -111,6 +114,9 @@ void save_config() { eeprom[simple_ui_steps_e] = ramp_stepss[2]; eeprom[simple_ui_active_e] = simple_ui_active; #endif + #ifdef USE_RAMP_AFTER_MOON_OPTION + eeprom[dont_ramp_after_moon_e] = dont_ramp_after_moon; + #endif #ifdef USE_MANUAL_MEMORY eeprom[manual_memory_e] = manual_memory; #ifdef USE_MANUAL_MEMORY_TIMER diff --git a/spaghetti-monster/anduril/off-mode.c b/spaghetti-monster/anduril/off-mode.c index 6faad1c..bf4642c 100644 --- a/spaghetti-monster/anduril/off-mode.c +++ b/spaghetti-monster/anduril/off-mode.c @@ -106,6 +106,11 @@ uint8_t off_state(Event event, uint16_t arg) { #else // B_RELEASE_T or B_TIMEOUT_T set_level(nearest_level(1)); #endif + #ifdef USE_RAMP_AFTER_MOON_OPTION + if (dont_ramp_after_moon) { + return MISCHIEF_MANAGED; + } + #endif // don't start ramping immediately; // give the user time to release at moon level //if (arg >= HOLD_TIMEOUT) { // smaller diff --git a/spaghetti-monster/anduril/ramp-mode.c b/spaghetti-monster/anduril/ramp-mode.c index 2508d52..634d8f2 100644 --- a/spaghetti-monster/anduril/ramp-mode.c +++ b/spaghetti-monster/anduril/ramp-mode.c @@ -419,9 +419,9 @@ uint8_t steady_state(Event event, uint16_t arg) { return MISCHIEF_MANAGED; } else if (event == EV_click10_hold) { - #ifdef USE_MANUAL_MEMORY_TIMER - // let user configure timer for manual / hybrid memory - push_state(manual_memory_timer_config_state, 0); + #ifdef USE_RAMP_EXTRAS_CONFIG + // let user configure a bunch of extra ramp options + push_state(ramp_extras_config_state, 0); #else // manual mem, but no timer // turn off manual memory; go back to automatic if (0 == arg) { @@ -479,19 +479,31 @@ uint8_t simple_ui_config_state(Event event, uint16_t arg) { #endif #endif // #ifdef USE_RAMP_CONFIG -#ifdef USE_MANUAL_MEMORY_TIMER -void manual_memory_timer_config_save(uint8_t step, uint8_t value) { +#ifdef USE_RAMP_EXTRAS_CONFIG +void ramp_extras_config_save(uint8_t step, uint8_t value) { // item 1: disable manual memory, go back to automatic - if (step == 1) { manual_memory = 0; } + if (1 == step) { manual_memory = 0; } + + #ifdef USE_MANUAL_MEMORY_TIMER // item 2: set manual memory timer duration // FIXME: should be limited to (65535 / SLEEP_TICKS_PER_MINUTE) // to avoid overflows or impossibly long timeouts // (by default, the effective limit is 145, but it allows up to 255) - else { manual_memory_timer = value; } + else if (2 == step) { manual_memory_timer = value; } + #endif + + #ifdef USE_RAMP_AFTER_MOON_OPTION + // item 3: ramp up after hold-from-off for moon? + // 0 = yes, ramp after moon + // 1+ = no, stay at moon + else if (3 == step) { + dont_ramp_after_moon = value; + } + #endif } -uint8_t manual_memory_timer_config_state(Event event, uint16_t arg) { - return config_state_base(event, arg, 2, manual_memory_timer_config_save); +uint8_t ramp_extras_config_state(Event event, uint16_t arg) { + return config_state_base(event, arg, 3, ramp_extras_config_save); } #endif diff --git a/spaghetti-monster/anduril/ramp-mode.h b/spaghetti-monster/anduril/ramp-mode.h index 7c8b014..7ad244a 100644 --- a/spaghetti-monster/anduril/ramp-mode.h +++ b/spaghetti-monster/anduril/ramp-mode.h @@ -127,8 +127,11 @@ uint8_t simple_ui_config_state(Event event, uint16_t arg); #endif #endif -#if defined(USE_MANUAL_MEMORY) && defined(USE_MANUAL_MEMORY_TIMER) -uint8_t manual_memory_timer_config_state(Event event, uint16_t arg); +#if defined(USE_MANUAL_MEMORY_TIMER) || defined(USE_RAMP_AFTER_MOON_OPTION) || defined(USE_2C_STYLE_OPTION) || defined(USE_AUTO_SUNSET) +#define USE_RAMP_EXTRAS_CONFIG +#endif +#ifdef USE_RAMP_EXTRAS_CONFIG +uint8_t ramp_extras_config_state(Event event, uint16_t arg); #endif // calculate the nearest ramp level which would be valid at the moment @@ -171,6 +174,12 @@ uint8_t ramp_style = RAMP_STYLE; // 0 = smooth, 1 = discrete #ifdef USE_RAMP_SPEED_CONFIG #define ramp_speed (ramp_stepss[0]) #endif +#ifdef USE_RAMP_AFTER_MOON_OPTION +#ifndef DEFAULT_DONT_RAMP_AFTER_MOON +#define DEFAULT_DONT_RAMP_AFTER_MOON 0 +#endif +uint8_t dont_ramp_after_moon = DEFAULT_DONT_RAMP_AFTER_MOON; +#endif // current values, regardless of style uint8_t ramp_floor = RAMP_SMOOTH_FLOOR; uint8_t ramp_ceil = RAMP_SMOOTH_CEIL; -- cgit v1.2.3 From f056ad231a259414c121cd3ab64df335acf10c5c Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 31 Aug 2021 14:50:48 -0600 Subject: added runtime option to choose Anduril 1 or Anduril 2 double-click turbo style (2C while on goes to full-power turbo (A1) or ceiling (A2)) also renamed _OPTION defs to _CONFIG for consistency --- spaghetti-monster/anduril/config-default.h | 5 +++- spaghetti-monster/anduril/hank-cfg.h | 2 +- spaghetti-monster/anduril/load-save-config-fsm.h | 5 +++- spaghetti-monster/anduril/load-save-config.c | 10 ++++++-- spaghetti-monster/anduril/off-mode.c | 2 +- spaghetti-monster/anduril/ramp-mode-fsm.h | 2 +- spaghetti-monster/anduril/ramp-mode.c | 32 ++++++++++++++++++------ spaghetti-monster/anduril/ramp-mode.h | 14 +++++++++-- 8 files changed, 55 insertions(+), 17 deletions(-) diff --git a/spaghetti-monster/anduril/config-default.h b/spaghetti-monster/anduril/config-default.h index 4beb753..16c7b49 100644 --- a/spaghetti-monster/anduril/config-default.h +++ b/spaghetti-monster/anduril/config-default.h @@ -72,7 +72,7 @@ #define USE_RAMP_SPEED_CONFIG // add runtime option for whether hold-from-off should ramp or stay at moon -#define USE_RAMP_AFTER_MOON_OPTION +#define USE_RAMP_AFTER_MOON_CONFIG // short blip when crossing from "click" to "hold" from off // (helps the user hit moon mode exactly, instead of holding too long @@ -90,6 +90,9 @@ // - Ramp 2C goes to ceiling, unless already at ceiling or in simple UI. // (Advanced UI ceiling 2C goes to turbo) //#define USE_2C_MAX_TURBO +// Or uncomment to let the user decide which style they want: +#define USE_2C_STYLE_CONFIG +//#define DEFAULT_2C_STYLE 2 // default to Anduril 2 style // make the ramps configurable by the user #define USE_RAMP_CONFIG diff --git a/spaghetti-monster/anduril/hank-cfg.h b/spaghetti-monster/anduril/hank-cfg.h index b55404f..11eb0a1 100644 --- a/spaghetti-monster/anduril/hank-cfg.h +++ b/spaghetti-monster/anduril/hank-cfg.h @@ -16,6 +16,6 @@ // double click while on goes to full-power turbo, not ramp ceiling -#define USE_2C_MAX_TURBO +#define DEFAULT_2C_STYLE 1 #endif // ifndef HANK_CFG diff --git a/spaghetti-monster/anduril/load-save-config-fsm.h b/spaghetti-monster/anduril/load-save-config-fsm.h index a6d1281..5058f0c 100644 --- a/spaghetti-monster/anduril/load-save-config-fsm.h +++ b/spaghetti-monster/anduril/load-save-config-fsm.h @@ -40,9 +40,12 @@ typedef enum { simple_ui_steps_e, simple_ui_active_e, #endif - #ifdef USE_RAMP_AFTER_MOON_OPTION + #ifdef USE_RAMP_AFTER_MOON_CONFIG dont_ramp_after_moon_e, #endif + #ifdef USE_2C_STYLE_CONFIG + ramp_2c_style_e, + #endif #ifdef USE_MANUAL_MEMORY manual_memory_e, #ifdef USE_MANUAL_MEMORY_TIMER diff --git a/spaghetti-monster/anduril/load-save-config.c b/spaghetti-monster/anduril/load-save-config.c index f564187..439576f 100644 --- a/spaghetti-monster/anduril/load-save-config.c +++ b/spaghetti-monster/anduril/load-save-config.c @@ -42,9 +42,12 @@ void load_config() { ramp_stepss[2] = eeprom[simple_ui_steps_e]; simple_ui_active = eeprom[simple_ui_active_e]; #endif - #ifdef USE_RAMP_AFTER_MOON_OPTION + #ifdef USE_RAMP_AFTER_MOON_CONFIG dont_ramp_after_moon = eeprom[dont_ramp_after_moon_e]; #endif + #ifdef USE_2C_STYLE_CONFIG + ramp_2c_style = eeprom[ramp_2c_style_e]; + #endif #ifdef USE_MANUAL_MEMORY manual_memory = eeprom[manual_memory_e]; #ifdef USE_MANUAL_MEMORY_TIMER @@ -114,9 +117,12 @@ void save_config() { eeprom[simple_ui_steps_e] = ramp_stepss[2]; eeprom[simple_ui_active_e] = simple_ui_active; #endif - #ifdef USE_RAMP_AFTER_MOON_OPTION + #ifdef USE_RAMP_AFTER_MOON_CONFIG eeprom[dont_ramp_after_moon_e] = dont_ramp_after_moon; #endif + #ifdef USE_2C_STYLE_CONFIG + eeprom[ramp_2c_style_e] = ramp_2c_style; + #endif #ifdef USE_MANUAL_MEMORY eeprom[manual_memory_e] = manual_memory; #ifdef USE_MANUAL_MEMORY_TIMER diff --git a/spaghetti-monster/anduril/off-mode.c b/spaghetti-monster/anduril/off-mode.c index bf4642c..5004e61 100644 --- a/spaghetti-monster/anduril/off-mode.c +++ b/spaghetti-monster/anduril/off-mode.c @@ -106,7 +106,7 @@ uint8_t off_state(Event event, uint16_t arg) { #else // B_RELEASE_T or B_TIMEOUT_T set_level(nearest_level(1)); #endif - #ifdef USE_RAMP_AFTER_MOON_OPTION + #ifdef USE_RAMP_AFTER_MOON_CONFIG if (dont_ramp_after_moon) { return MISCHIEF_MANAGED; } diff --git a/spaghetti-monster/anduril/ramp-mode-fsm.h b/spaghetti-monster/anduril/ramp-mode-fsm.h index 425ac69..7f67d1e 100644 --- a/spaghetti-monster/anduril/ramp-mode-fsm.h +++ b/spaghetti-monster/anduril/ramp-mode-fsm.h @@ -47,7 +47,7 @@ #endif // include an extra config mode for random stuff which doesn't fit elsewhere -#if defined(USE_JUMP_START) || defined(USE_2C_STYLE_CONFIG) +#if defined(USE_JUMP_START) #define USE_GLOBALS_CONFIG #endif diff --git a/spaghetti-monster/anduril/ramp-mode.c b/spaghetti-monster/anduril/ramp-mode.c index 634d8f2..5317b27 100644 --- a/spaghetti-monster/anduril/ramp-mode.c +++ b/spaghetti-monster/anduril/ramp-mode.c @@ -101,7 +101,7 @@ uint8_t steady_state(Event event, uint16_t arg) { // 2 clicks: go to/from highest level else if (event == EV_2clicks) { uint8_t turbo_level; - #ifdef USE_2C_MAX_TURBO + #ifdef USE_2C_MAX_TURBO // Anduril 1 style always // simple UI: to/from ceiling // full UI: to/from turbo (Anduril1 behavior) #ifdef USE_SIMPLE_UI @@ -109,7 +109,18 @@ uint8_t steady_state(Event event, uint16_t arg) { else #endif turbo_level = MAX_LEVEL; - #else + #elif defined(USE_2C_STYLE_CONFIG) // user can choose A1 style or A2 style + #ifdef USE_SIMPLE_UI + // no turbo in simple UI yet (needs its own config) + if (simple_ui_active) turbo_level = mode_max; + else + #endif + if (ramp_2c_style <= 1) turbo_level = MAX_LEVEL; + else { + if (memorized_level < mode_max) { turbo_level = mode_max; } + else { turbo_level = MAX_LEVEL; } + } + #else // Anduril 2 style always // simple UI: to/from ceiling // full UI: to/from ceiling if mem < ceiling, // or to/from turbo if mem >= ceiling @@ -492,7 +503,7 @@ void ramp_extras_config_save(uint8_t step, uint8_t value) { else if (2 == step) { manual_memory_timer = value; } #endif - #ifdef USE_RAMP_AFTER_MOON_OPTION + #ifdef USE_RAMP_AFTER_MOON_CONFIG // item 3: ramp up after hold-from-off for moon? // 0 = yes, ramp after moon // 1+ = no, stay at moon @@ -500,20 +511,25 @@ void ramp_extras_config_save(uint8_t step, uint8_t value) { dont_ramp_after_moon = value; } #endif + + #ifdef USE_2C_STYLE_CONFIG + // item 4: Anduril 1 2C turbo, or Anduril 2 2C ceiling? + // 1 = Anduril 1, 2C turbo + // 2+ = Anduril 2, 2C ceiling + else if (4 == step) { + if (value) ramp_2c_style = value; + } + #endif } uint8_t ramp_extras_config_state(Event event, uint16_t arg) { - return config_state_base(event, arg, 3, ramp_extras_config_save); + return config_state_base(event, arg, 4, ramp_extras_config_save); } #endif #ifdef USE_GLOBALS_CONFIG void globals_config_save(uint8_t step, uint8_t value) { if (0) {} - #ifdef USE_2C_STYLE_CONFIG - // TODO: make double-click style configurable (turbo or ceil) - else if (1 == step) {} - #endif #ifdef USE_JUMP_START else { jump_start_level = value; } #endif diff --git a/spaghetti-monster/anduril/ramp-mode.h b/spaghetti-monster/anduril/ramp-mode.h index 7ad244a..242d7aa 100644 --- a/spaghetti-monster/anduril/ramp-mode.h +++ b/spaghetti-monster/anduril/ramp-mode.h @@ -127,7 +127,7 @@ uint8_t simple_ui_config_state(Event event, uint16_t arg); #endif #endif -#if defined(USE_MANUAL_MEMORY_TIMER) || defined(USE_RAMP_AFTER_MOON_OPTION) || defined(USE_2C_STYLE_OPTION) || defined(USE_AUTO_SUNSET) +#if defined(USE_MANUAL_MEMORY_TIMER) || defined(USE_RAMP_AFTER_MOON_CONFIG) || defined(USE_2C_STYLE_CONFIG) || defined(USE_AUTO_SUNSET) #define USE_RAMP_EXTRAS_CONFIG #endif #ifdef USE_RAMP_EXTRAS_CONFIG @@ -171,10 +171,20 @@ uint8_t simple_ui_active = SIMPLE_UI_ACTIVE; #endif // smooth vs discrete ramping uint8_t ramp_style = RAMP_STYLE; // 0 = smooth, 1 = discrete +#ifdef USE_2C_STYLE_CONFIG +#ifndef DEFAULT_2C_STYLE +#define DEFAULT_2C_STYLE 2 +#endif +uint8_t ramp_2c_style = DEFAULT_2C_STYLE; // 1 = A1 style, 2 = A2 style +#ifdef USE_2C_MAX_TURBO +#error Cannot use USE_2C_MAX_TURBO and USE_2C_STYLE_CONFIG at the same time. +#endif +#endif + #ifdef USE_RAMP_SPEED_CONFIG #define ramp_speed (ramp_stepss[0]) #endif -#ifdef USE_RAMP_AFTER_MOON_OPTION +#ifdef USE_RAMP_AFTER_MOON_CONFIG #ifndef DEFAULT_DONT_RAMP_AFTER_MOON #define DEFAULT_DONT_RAMP_AFTER_MOON 0 #endif -- cgit v1.2.3 From 8869bcd869da0451e4a3c12f1e026dad0da2c365 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 31 Aug 2021 15:03:48 -0600 Subject: added third 2C style: 0 = no turbo (but it's still available as momentary) (also, adding this reduced the ROM size somehow) --- spaghetti-monster/anduril/config-default.h | 4 ++++ spaghetti-monster/anduril/ramp-mode.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/spaghetti-monster/anduril/config-default.h b/spaghetti-monster/anduril/config-default.h index 16c7b49..7670df4 100644 --- a/spaghetti-monster/anduril/config-default.h +++ b/spaghetti-monster/anduril/config-default.h @@ -92,6 +92,10 @@ //#define USE_2C_MAX_TURBO // Or uncomment to let the user decide which style they want: #define USE_2C_STYLE_CONFIG +// 0 = no turbo +// 1 = A1 style: Off 2C = ceil, On 2C = turbo +// 2 = A2 style: Off 2C = ceil, On 2C = ceil, Ramped ceil 2C = turbo +// All styles allow momentary turbo in advanced UI //#define DEFAULT_2C_STYLE 2 // default to Anduril 2 style // make the ramps configurable by the user diff --git a/spaghetti-monster/anduril/ramp-mode.c b/spaghetti-monster/anduril/ramp-mode.c index 5317b27..4922e2c 100644 --- a/spaghetti-monster/anduril/ramp-mode.c +++ b/spaghetti-monster/anduril/ramp-mode.c @@ -115,7 +115,11 @@ uint8_t steady_state(Event event, uint16_t arg) { if (simple_ui_active) turbo_level = mode_max; else #endif - if (ramp_2c_style <= 1) turbo_level = MAX_LEVEL; + // 0 = no turbo + // 1 = Anduril 1 direct to turbo + // 2 = Anduril 2 direct to ceiling, or turbo if already at ceiling + if (0 == ramp_2c_style) turbo_level = mode_max; + else if (1 == ramp_2c_style) turbo_level = MAX_LEVEL; else { if (memorized_level < mode_max) { turbo_level = mode_max; } else { turbo_level = MAX_LEVEL; } @@ -517,7 +521,7 @@ void ramp_extras_config_save(uint8_t step, uint8_t value) { // 1 = Anduril 1, 2C turbo // 2+ = Anduril 2, 2C ceiling else if (4 == step) { - if (value) ramp_2c_style = value; + ramp_2c_style = value; } #endif } -- cgit v1.2.3 From fe13ae8f3cbe49ecb8edc8eeff203496138ef40a Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 31 Aug 2021 22:07:45 -0600 Subject: made 2C ceiling/turbo behavior configurable in Simple UI also made it possible to block turbo in Advanced UI (each one has a 2C style: 0 = no turbo, only ceiling 1 = Anduril 1 style, direct to turbo 2 = Anduril 2 style, ceiling unless already there, then turbo ) --- spaghetti-monster/anduril/config-default.h | 1 + spaghetti-monster/anduril/load-save-config-fsm.h | 3 + spaghetti-monster/anduril/load-save-config.c | 6 ++ spaghetti-monster/anduril/off-mode.c | 29 ++++++-- spaghetti-monster/anduril/ramp-mode.c | 93 ++++++++++++++---------- spaghetti-monster/anduril/ramp-mode.h | 10 ++- 6 files changed, 95 insertions(+), 47 deletions(-) diff --git a/spaghetti-monster/anduril/config-default.h b/spaghetti-monster/anduril/config-default.h index 7670df4..9c194f9 100644 --- a/spaghetti-monster/anduril/config-default.h +++ b/spaghetti-monster/anduril/config-default.h @@ -97,6 +97,7 @@ // 2 = A2 style: Off 2C = ceil, On 2C = ceil, Ramped ceil 2C = turbo // All styles allow momentary turbo in advanced UI //#define DEFAULT_2C_STYLE 2 // default to Anduril 2 style +//#define DEFAULT_2C_STYLE_SIMPLE 0 // no turbo at all // make the ramps configurable by the user #define USE_RAMP_CONFIG diff --git a/spaghetti-monster/anduril/load-save-config-fsm.h b/spaghetti-monster/anduril/load-save-config-fsm.h index 5058f0c..894c344 100644 --- a/spaghetti-monster/anduril/load-save-config-fsm.h +++ b/spaghetti-monster/anduril/load-save-config-fsm.h @@ -39,6 +39,9 @@ typedef enum { simple_ui_ceil_e, simple_ui_steps_e, simple_ui_active_e, + #ifdef USE_2C_STYLE_CONFIG + ramp_2c_style_simple_e, + #endif #endif #ifdef USE_RAMP_AFTER_MOON_CONFIG dont_ramp_after_moon_e, diff --git a/spaghetti-monster/anduril/load-save-config.c b/spaghetti-monster/anduril/load-save-config.c index 439576f..ee451ac 100644 --- a/spaghetti-monster/anduril/load-save-config.c +++ b/spaghetti-monster/anduril/load-save-config.c @@ -41,6 +41,9 @@ void load_config() { ramp_ceils[2] = eeprom[simple_ui_ceil_e]; ramp_stepss[2] = eeprom[simple_ui_steps_e]; simple_ui_active = eeprom[simple_ui_active_e]; + #ifdef USE_2C_STYLE_CONFIG + ramp_2c_style_simple = eeprom[ramp_2c_style_simple_e]; + #endif #endif #ifdef USE_RAMP_AFTER_MOON_CONFIG dont_ramp_after_moon = eeprom[dont_ramp_after_moon_e]; @@ -116,6 +119,9 @@ void save_config() { eeprom[simple_ui_ceil_e] = ramp_ceils[2]; eeprom[simple_ui_steps_e] = ramp_stepss[2]; eeprom[simple_ui_active_e] = simple_ui_active; + #ifdef USE_2C_STYLE_CONFIG + eeprom[ramp_2c_style_simple_e] = ramp_2c_style_simple; + #endif #endif #ifdef USE_RAMP_AFTER_MOON_CONFIG eeprom[dont_ramp_after_moon_e] = dont_ramp_after_moon; diff --git a/spaghetti-monster/anduril/off-mode.c b/spaghetti-monster/anduril/off-mode.c index 5004e61..236ad7e 100644 --- a/spaghetti-monster/anduril/off-mode.c +++ b/spaghetti-monster/anduril/off-mode.c @@ -155,14 +155,29 @@ uint8_t off_state(Event event, uint16_t arg) { } // click, hold: momentary at ceiling or turbo else if (event == EV_click2_hold) { - #ifdef USE_SIMPLE_UI - if (simple_ui_active) { - set_level(nearest_level(MAX_LEVEL)); - } else + uint8_t turbo_level; // how bright is "turbo"? + + #if defined(USE_2C_STYLE_CONFIG) // user can choose 2C behavior + uint8_t style_2c = ramp_2c_style; + #ifdef USE_SIMPLE_UI + // simple UI has its own turbo config + if (simple_ui_active) style_2c = ramp_2c_style_simple; + #endif + // 0 = ceiling + // 1+ = full power + if (0 == style_2c) turbo_level = nearest_level(MAX_LEVEL); + else turbo_level = MAX_LEVEL; + #else + // simple UI: ceiling + // full UI: full power + #ifdef USE_SIMPLE_UI + if (simple_ui_active) turbo_level = nearest_level(MAX_LEVEL); + else + #endif + turbo_level = MAX_LEVEL; #endif - { - set_level(MAX_LEVEL); - } + + set_level(turbo_level); return MISCHIEF_MANAGED; } else if (event == EV_click2_hold_release) { diff --git a/spaghetti-monster/anduril/ramp-mode.c b/spaghetti-monster/anduril/ramp-mode.c index 4922e2c..31f959b 100644 --- a/spaghetti-monster/anduril/ramp-mode.c +++ b/spaghetti-monster/anduril/ramp-mode.c @@ -45,6 +45,43 @@ uint8_t steady_state(Event event, uint16_t arg) { if (ramp_style) { step_size = ramp_discrete_step_size; } else { step_size = 1; } + // how bright is "turbo"? + uint8_t turbo_level; + #if defined(USE_2C_STYLE_CONFIG) // user can choose 2C behavior + uint8_t style_2c = ramp_2c_style; + #ifdef USE_SIMPLE_UI + // simple UI has its own turbo config + if (simple_ui_active) style_2c = ramp_2c_style_simple; + #endif + // 0 = no turbo + // 1 = Anduril 1 direct to turbo + // 2 = Anduril 2 direct to ceiling, or turbo if already at ceiling + if (0 == style_2c) turbo_level = mode_max; + else if (1 == style_2c) turbo_level = MAX_LEVEL; + else { + if (memorized_level < mode_max) { turbo_level = mode_max; } + else { turbo_level = MAX_LEVEL; } + } + #elif defined(USE_2C_MAX_TURBO) // Anduril 1 style always + // simple UI: to/from ceiling + // full UI: to/from turbo (Anduril1 behavior) + #ifdef USE_SIMPLE_UI + if (simple_ui_active) turbo_level = mode_max; + else + #endif + turbo_level = MAX_LEVEL; + #else // Anduril 2 style always + // simple UI: to/from ceiling + // full UI: to/from ceiling if mem < ceiling, + // or to/from turbo if mem >= ceiling + if ((memorized_level < mode_max) + #ifdef USE_SIMPLE_UI + || simple_ui_active + #endif + ) { turbo_level = mode_max; } + else { turbo_level = MAX_LEVEL; } + #endif + #ifdef USE_SUNSET_TIMER // handle the shutoff timer first static uint8_t timer_orig_level = 0; @@ -100,42 +137,6 @@ uint8_t steady_state(Event event, uint16_t arg) { } // 2 clicks: go to/from highest level else if (event == EV_2clicks) { - uint8_t turbo_level; - #ifdef USE_2C_MAX_TURBO // Anduril 1 style always - // simple UI: to/from ceiling - // full UI: to/from turbo (Anduril1 behavior) - #ifdef USE_SIMPLE_UI - if (simple_ui_active) turbo_level = mode_max; - else - #endif - turbo_level = MAX_LEVEL; - #elif defined(USE_2C_STYLE_CONFIG) // user can choose A1 style or A2 style - #ifdef USE_SIMPLE_UI - // no turbo in simple UI yet (needs its own config) - if (simple_ui_active) turbo_level = mode_max; - else - #endif - // 0 = no turbo - // 1 = Anduril 1 direct to turbo - // 2 = Anduril 2 direct to ceiling, or turbo if already at ceiling - if (0 == ramp_2c_style) turbo_level = mode_max; - else if (1 == ramp_2c_style) turbo_level = MAX_LEVEL; - else { - if (memorized_level < mode_max) { turbo_level = mode_max; } - else { turbo_level = MAX_LEVEL; } - } - #else // Anduril 2 style always - // simple UI: to/from ceiling - // full UI: to/from ceiling if mem < ceiling, - // or to/from turbo if mem >= ceiling - if ((memorized_level < mode_max) - #ifdef USE_SIMPLE_UI - || simple_ui_active - #endif - ) { turbo_level = mode_max; } - else { turbo_level = MAX_LEVEL; } - #endif - if (actual_level < turbo_level) { set_level_and_therm_target(turbo_level); } @@ -395,7 +396,7 @@ uint8_t steady_state(Event event, uint16_t arg) { // 3H: momentary turbo (on lights with no tint ramping) else if (event == EV_click3_hold) { if (! arg) { // first frame only, to allow thermal regulation to work - set_level_and_therm_target(MAX_LEVEL); + set_level_and_therm_target(turbo_level); } return MISCHIEF_MANAGED; } @@ -462,6 +463,15 @@ void ramp_config_save(uint8_t step, uint8_t value) { if (current_state == simple_ui_config_state) style = 2; #endif + #if defined(USE_SIMPLE_UI) && defined(USE_2C_STYLE_CONFIG) + // simple UI config is weird... + // has some ramp extras after floor/ceil/steps + if (4 == step) { + ramp_2c_style_simple = value; + } + else + #endif + // save adjusted value to the correct slot if (value) { // ceiling value is inverted @@ -489,7 +499,14 @@ uint8_t ramp_config_state(Event event, uint16_t arg) { #ifdef USE_SIMPLE_UI uint8_t simple_ui_config_state(Event event, uint16_t arg) { - return config_state_base(event, arg, 3, ramp_config_save); + #if defined(USE_2C_STYLE_CONFIG) + #define SIMPLE_UI_NUM_MENU_ITEMS 4 + #else + #define SIMPLE_UI_NUM_MENU_ITEMS 3 + #endif + return config_state_base(event, arg, + SIMPLE_UI_NUM_MENU_ITEMS, + ramp_config_save); } #endif #endif // #ifdef USE_RAMP_CONFIG diff --git a/spaghetti-monster/anduril/ramp-mode.h b/spaghetti-monster/anduril/ramp-mode.h index 242d7aa..bba6d96 100644 --- a/spaghetti-monster/anduril/ramp-mode.h +++ b/spaghetti-monster/anduril/ramp-mode.h @@ -166,8 +166,14 @@ uint8_t manual_memory_timer = DEFAULT_MANUAL_MEMORY_TIMER; #endif #endif #ifdef USE_SIMPLE_UI -// whether to enable the simplified interface or not -uint8_t simple_ui_active = SIMPLE_UI_ACTIVE; + // whether to enable the simplified interface or not + uint8_t simple_ui_active = SIMPLE_UI_ACTIVE; + #ifdef USE_2C_STYLE_CONFIG + #ifndef DEFAULT_2C_STYLE_SIMPLE + #define DEFAULT_2C_STYLE_SIMPLE 0 + #endif + uint8_t ramp_2c_style_simple = DEFAULT_2C_STYLE_SIMPLE; // 0 = no turbo, 1 = A1 style, 2 = A2 style + #endif #endif // smooth vs discrete ramping uint8_t ramp_style = RAMP_STYLE; // 0 = smooth, 1 = discrete -- cgit v1.2.3 From ecb8f7456687b24a30deacdabbed94bb0922ba75 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 31 Aug 2021 22:37:47 -0600 Subject: documented recent changes in the user manual --- spaghetti-monster/anduril/anduril-manual.txt | 84 +++++++++++++++++++++------- 1 file changed, 64 insertions(+), 20 deletions(-) diff --git a/spaghetti-monster/anduril/anduril-manual.txt b/spaghetti-monster/anduril/anduril-manual.txt index 74ca0c7..ef0ad5f 100644 --- a/spaghetti-monster/anduril/anduril-manual.txt +++ b/spaghetti-monster/anduril/anduril-manual.txt @@ -51,8 +51,8 @@ light to someone else, or if you just don't want to bother with any crazy disco modes. Simple UI has all the basic functions needed to work as a flashlight, -but the minimum and maximum brightness are limited to make it safer, and -any complex or advanced functions are blocked. +but the minimum and maximum brightness are limited by default to make it +safer, and any complex or advanced functions are blocked. Functions available in Simple UI include: @@ -112,6 +112,29 @@ counting it like music to make it easier: Simple UI is enabled after each factory reset. +Simple UI can be configured in several ways, but not while Simple UI is +active. So go to the Advanced UI, configure things, then go back to +Simple UI. + +Configurable options include: + + - floor level + - ceiling level + - number of steps (in stepped ramp) + - turbo style + +Other options are inherited from Advanced UI: + + - ramp style (smooth / stepped) + - smooth ramp speed + - ramp-after-moon style + - memory settings + - auto-lock settings + - aux LED settings + - voltage calibration + - thermal regulation settings + - hardware-specific "misc menu" settings + Advanced UI ----------- @@ -168,15 +191,30 @@ While the light is on, a few actions are available: - 7H: Ramp config menu. - Item 1: Floor level. - Item 2: Ceiling level. - - Item 3: Number of steps (except for smooth ramp). + - Item 3: + Stepped ramp: Number of steps. Can be 1 to 150. + Smooth ramp: Ramp speed. + 1 = Full speed, ~2.5s from end to end. + 2 = Half speed, ~5s from end to end. + 3 = Third speed, ~7.5s. + 4 = Quarter speed, ~10s. - 10C: Activate manual memory and save the current brightness. - - 10H: Manual memory config menu. + - 10H: Ramp extras config menu. - Item 1: Disable manual memory and go back to automatic memory. (doesn't matter what value the user enters at the prompt) - Item 2: Configure the manual memory timer. Sets the timer to N minutes, where N is the number of clicks. A value of 0 (no clicks) turns the timer off. + - Item 3: Configure whether to ramp up after "Off -> 1H". + 0: Ramp up after moon. + 1: Don't ramp up, just stay at the floor level. + - Item 4: Configure Advanced UI's turbo style: + 0: No turbo, only ceiling. + 1: Anduril 1 style. Ramp -> 2C goes to full power. + 2: Anduril 2 style. Ramp -> 2C goes to ceiling, + or goes to full power if user ramped up to ceiling first. + This value also affects momentary turbo in Ramp and Off modes. Memory determines which brightness level the light goes to with 1 click from off. There are three types of brightness memory to choose from: @@ -240,6 +278,7 @@ more than 2 times when the light is off: - 4C: Lockout mode. - 5C: Momentary mode. - 7C / 7H: Aux LED configuration. + - 9H: Misc configuration menu. (only on some lights) - 10H: Simple UI configuration menu. - 13H: Factory reset (on some lights). - 15C or more: Version check. @@ -508,10 +547,11 @@ final click) to access the config menu for the current ramp. Or, to access the ramp config for Simple UI, make sure the Simple UI is not active, then do a 10H action from Off. -For smooth ramping mode, there are two menu options: +For smooth ramping mode, there are three menu options: 1. Floor. (default = 1/150) 2. Ceiling. (default = 120/150) + 3. Ramp speed. (default = 1, fastest speed) For the stepped ramping mode, there are three menu options: @@ -519,12 +559,13 @@ For the stepped ramping mode, there are three menu options: 2. Ceiling. (default = 120/150) 3. Number of steps. (default = 7) -For the Simple UI mode, there are three menu options. They are the same -as stepped ramping mode. +For the Simple UI mode, there are four menu options. The first three +are the same as stepped ramping mode. 1. Floor. (default = 20/150) 2. Ceiling. (default = 120/150) 3. Number of steps. (default = 5) + 4. Turbo style. (default = 0, no turbo) Default values are different for each model of flashlight. The numbers above are only examples. @@ -639,17 +680,12 @@ when the main emitters are on, and when the light is otherwise awake. The aux LEDs on most lights only turn on when the light is asleep. -Global Config Menu ------------------- +Misc Config Menu +---------------- Some models may have an extra config menu for settings which don't fit anywhere else. These settings are, in order: - - 2C style: (not yet implemented) - - 1: 2C goes to turbo (Anduril V1 style) - 2: 2C goes to ramp ceiling (Anduril V2 style) - - Jump Start level: Some lights are prone to starting up slowly at low levels, so they @@ -657,9 +693,9 @@ anywhere else. These settings are, in order: level for a few milliseconds when changing from off to a low level. This setting specifies how bright that pulse should be. - The value can be from 1 to 150, but is usually between 10 and 30. + The value can be from 1 to 150, but is usually between 20 and 50. -Some settings are hardware-specific and may not be present on all +These settings are hardware-specific and may not be present on all lights. The number of settings in the global menu depends on the hardware model and the firmware version. @@ -705,10 +741,14 @@ Off Any 4C Lockout mode Off Full 5C Momentary mode Off Full 7C Aux LEDs: Next pattern Off Full 7H Aux LEDs: Next color -Off Full 9H Global config menu +Off Full 9H Misc config menu (varies per light) Off Full 10C Enable Simple UI Off Simple 10H Disable Simple UI -Off Full 10H Simple UI ramp config menu (1: floor, 2: ceiling, [3: steps]) +Off Full 10H Simple UI ramp config menu: + 1: floor + 2: ceiling + 3: steps + 4: turbo style Off Any 13H Factory reset (on some lights) Off Any 15+C Version check @@ -723,9 +763,13 @@ Ramp Full 3H Momentary turbo (on lights without tint ramping) Ramp Any 4C Lockout mode Ramp Full 5C Momentary mode Ramp Full 5H Sunset timer on, and add 5 minutes -Ramp Full 7H Ramp config menu (1: floor, 2: ceiling, [3: steps]) +Ramp Full 7H Ramp config menu (1: floor, 2: ceiling, 3: speed/steps) Ramp Full 10C Turn on manual memory and save current brightness -Ramp Full 10H Manual memory config menu (1: off, 2: set timeout) +Ramp Full 10H Ramp Extras config menu: + 1: enable automatic mem + 2: set manual mem timeout + 3: ramp after moon or not + 4: advanced UI turbo style Lockout Any 1C/1H Momentary moon (lowest floor) Lockout Any 2C/2H Momentary moon (highest floor, or manual mem level) -- cgit v1.2.3 From dcc39c757b65fbbf3c85d927b699825807846bf7 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 31 Aug 2021 22:48:13 -0600 Subject: reduced length of auto-reverse timing window from ~1000 ms to ~660ms, because it was too fast --- spaghetti-monster/anduril/candle-mode.c | 2 +- spaghetti-monster/anduril/config-default.h | 3 +++ spaghetti-monster/anduril/ramp-mode.c | 2 +- spaghetti-monster/anduril/strobe-modes.c | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/spaghetti-monster/anduril/candle-mode.c b/spaghetti-monster/anduril/candle-mode.c index 3704ee6..d15195e 100644 --- a/spaghetti-monster/anduril/candle-mode.c +++ b/spaghetti-monster/anduril/candle-mode.c @@ -98,7 +98,7 @@ uint8_t candle_mode_state(Event event, uint16_t arg) { // clock tick: animate candle brightness else if (event == EV_tick) { // un-reverse after 1 second - if (arg == TICKS_PER_SECOND) ramp_direction = 1; + if (arg == AUTO_REVERSE_TIME) ramp_direction = 1; // 3-oscillator synth for a relatively organic pattern uint8_t add; diff --git a/spaghetti-monster/anduril/config-default.h b/spaghetti-monster/anduril/config-default.h index 9c194f9..5b9897c 100644 --- a/spaghetti-monster/anduril/config-default.h +++ b/spaghetti-monster/anduril/config-default.h @@ -71,6 +71,9 @@ // smooth ramp speed: 1, 2, 3, 4, ... for 1X speed, 1/2, 1/3rd, 1/4th, ... #define USE_RAMP_SPEED_CONFIG +// after ramping, how long until the direction resets to "up"? +#define AUTO_REVERSE_TIME (TICKS_PER_SECOND * 2 / 3) + // add runtime option for whether hold-from-off should ramp or stay at moon #define USE_RAMP_AFTER_MOON_CONFIG diff --git a/spaghetti-monster/anduril/ramp-mode.c b/spaghetti-monster/anduril/ramp-mode.c index 31f959b..6d85480 100644 --- a/spaghetti-monster/anduril/ramp-mode.c +++ b/spaghetti-monster/anduril/ramp-mode.c @@ -258,7 +258,7 @@ uint8_t steady_state(Event event, uint16_t arg) { else if (event == EV_tick) { // un-reverse after 1 second - if (arg == TICKS_PER_SECOND) ramp_direction = 1; + if (arg == AUTO_REVERSE_TIME) ramp_direction = 1; #ifdef USE_SUNSET_TIMER // reduce output if shutoff timer is active diff --git a/spaghetti-monster/anduril/strobe-modes.c b/spaghetti-monster/anduril/strobe-modes.c index b27f298..d5f12c0 100644 --- a/spaghetti-monster/anduril/strobe-modes.c +++ b/spaghetti-monster/anduril/strobe-modes.c @@ -153,7 +153,7 @@ uint8_t strobe_state(Event event, uint16_t arg) { // clock tick: bump the random seed else if (event == EV_tick) { // un-reverse after 1 second - if (arg == TICKS_PER_SECOND) ramp_direction = 1; + if (arg == AUTO_REVERSE_TIME) ramp_direction = 1; pseudo_rand_seed += arg; return MISCHIEF_MANAGED; -- cgit v1.2.3 From d3e37a3825c3a8f0971b197aa3ac543a25337f4d Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 31 Aug 2021 22:58:46 -0600 Subject: fixed builds which failed to compile after recent changes --- spaghetti-monster/anduril/cfg-ff-rot66.h | 2 ++ spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h | 2 +- spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h | 4 ++++ spaghetti-monster/anduril/cfg-sofirn-sp10s.h | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/spaghetti-monster/anduril/cfg-ff-rot66.h b/spaghetti-monster/anduril/cfg-ff-rot66.h index 652c98b..7e21fe7 100644 --- a/spaghetti-monster/anduril/cfg-ff-rot66.h +++ b/spaghetti-monster/anduril/cfg-ff-rot66.h @@ -41,3 +41,5 @@ #undef BLINK_AT_RAMP_MIDDLE #undef BLINK_AT_RAMP_CEIL +// too big, remove stuff to make room +#undef USE_RAMP_AFTER_MOON_CONFIG diff --git a/spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h b/spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h index 192307e..9036d26 100644 --- a/spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h +++ b/spaghetti-monster/anduril/cfg-gchart-fet1-t1616.h @@ -32,4 +32,4 @@ #define THERM_FASTER_LEVEL 105 // enable 2 click turbo -#define USE_2C_MAX_TURBO +#define DEFAULT_2C_STYLE 1 diff --git a/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h index de5da88..962317e 100644 --- a/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h +++ b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h @@ -50,3 +50,7 @@ #define THERM_FASTER_LEVEL 130 // throttle back faster when high + + +// too big, remove stuff to make room +#undef USE_RAMP_SPEED_CONFIG diff --git a/spaghetti-monster/anduril/cfg-sofirn-sp10s.h b/spaghetti-monster/anduril/cfg-sofirn-sp10s.h index 99ed17d..06720b6 100644 --- a/spaghetti-monster/anduril/cfg-sofirn-sp10s.h +++ b/spaghetti-monster/anduril/cfg-sofirn-sp10s.h @@ -25,4 +25,4 @@ #define THERM_FASTER_LEVEL 105 // enable 2 click turbo -#define USE_2C_MAX_TURBO +#define DEFAULT_2C_STYLE 1 -- cgit v1.2.3