diff options
| author | Selene ToyKeeper | 2021-08-31 14:50:48 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2021-08-31 14:50:48 -0600 |
| commit | f056ad231a259414c121cd3ab64df335acf10c5c (patch) | |
| tree | 522df757a8ece8aa4e46676b9247c47ca7170496 | |
| parent | added runtime option to select whether to ramp up after hold-from-off (defaul... (diff) | |
| download | anduril-f056ad231a259414c121cd3ab64df335acf10c5c.tar.gz anduril-f056ad231a259414c121cd3ab64df335acf10c5c.tar.bz2 anduril-f056ad231a259414c121cd3ab64df335acf10c5c.zip | |
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
| -rw-r--r-- | spaghetti-monster/anduril/config-default.h | 5 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/hank-cfg.h | 2 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/load-save-config-fsm.h | 5 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/load-save-config.c | 10 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/off-mode.c | 2 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/ramp-mode-fsm.h | 2 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/ramp-mode.c | 32 | ||||
| -rw-r--r-- | 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 |
