diff options
| author | Selene ToyKeeper | 2023-05-02 05:19:50 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2023-05-02 05:19:50 -0600 |
| commit | e8d7e8ea11696bb2cad60c309527d02f130f7687 (patch) | |
| tree | 5359ec480940ff2c7ed7e38e5cc847086ed3d70f | |
| parent | converted Wurkkos TS10 build (and made its ramp smoother w/ better low modes) (diff) | |
| download | anduril-e8d7e8ea11696bb2cad60c309527d02f130f7687.tar.gz anduril-e8d7e8ea11696bb2cad60c309527d02f130f7687.tar.bz2 anduril-e8d7e8ea11696bb2cad60c309527d02f130f7687.zip | |
added ability to set channel mode for number readouts (batt check, temp check, version check)
Press 3C in batt check mode to change the blink channel.
Also fixed TS10 stepped ramp ceiling value.
| -rw-r--r-- | spaghetti-monster/anduril/battcheck-mode.c | 9 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/cfg-wurkkos-ts10.h | 5 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/load-save-config-fsm.h | 3 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/load-save-config.h | 4 | ||||
| -rw-r--r-- | spaghetti-monster/fsm-misc.c | 10 | ||||
| -rw-r--r-- | spaghetti-monster/fsm-misc.h | 13 |
6 files changed, 39 insertions, 5 deletions
diff --git a/spaghetti-monster/anduril/battcheck-mode.c b/spaghetti-monster/anduril/battcheck-mode.c index 9eb82fe..7e25f79 100644 --- a/spaghetti-monster/anduril/battcheck-mode.c +++ b/spaghetti-monster/anduril/battcheck-mode.c @@ -31,6 +31,15 @@ uint8_t battcheck_state(Event event, uint16_t arg) { return MISCHIEF_MANAGED; } + #ifdef DEFAULT_BLINK_CHANNEL + // 3 clicks: next channel mode (specific to number blinky modes) + else if (event == EV_3clicks) { + cfg.blink_channel = (cfg.blink_channel + 1) % NUM_CHANNEL_MODES; + save_config(); + return EVENT_HANDLED; + } + #endif // ifdef DEFAULT_BLINK_CHANNEL + #ifdef USE_VOLTAGE_CORRECTION // 7H: voltage config mode else if (event == EV_click7_hold) { diff --git a/spaghetti-monster/anduril/cfg-wurkkos-ts10.h b/spaghetti-monster/anduril/cfg-wurkkos-ts10.h index 4b82949..8e3462e 100644 --- a/spaghetti-monster/anduril/cfg-wurkkos-ts10.h +++ b/spaghetti-monster/anduril/cfg-wurkkos-ts10.h @@ -55,7 +55,7 @@ #define RAMP_SMOOTH_CEIL 150 // 20 38 56 [75] 93 111 130 #define RAMP_DISCRETE_FLOOR 20 -#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL +#define RAMP_DISCRETE_CEIL 130 #define RAMP_DISCRETE_STEPS 7 // at Wurkkos's request, reduce the Simple UI ceiling a little bit @@ -74,6 +74,9 @@ // show each channel while it scroll by in the menu #define USE_CONFIG_COLORS +// blink numbers on the aux LEDs by default +#define DEFAULT_BLINK_CHANNEL CM_AUX + // enable SOS in the blinkies group #define USE_SOS_MODE #define USE_SOS_MODE_IN_BLINKY_GROUP diff --git a/spaghetti-monster/anduril/load-save-config-fsm.h b/spaghetti-monster/anduril/load-save-config-fsm.h index ceb9d76..df46fc5 100644 --- a/spaghetti-monster/anduril/load-save-config-fsm.h +++ b/spaghetti-monster/anduril/load-save-config-fsm.h @@ -52,6 +52,9 @@ typedef struct Config { #ifdef USE_MANUAL_MEMORY uint8_t manual_memory_channel_mode; #endif + #ifdef DEFAULT_BLINK_CHANNEL + uint8_t blink_channel; + #endif #endif #ifdef USE_CHANNEL_MODE_ARGS // this is an array, needs a few bytes diff --git a/spaghetti-monster/anduril/load-save-config.h b/spaghetti-monster/anduril/load-save-config.h index 60612d3..278d286 100644 --- a/spaghetti-monster/anduril/load-save-config.h +++ b/spaghetti-monster/anduril/load-save-config.h @@ -77,6 +77,10 @@ Config cfg = { // reset w/ manual memory .manual_memory_channel_mode = DEFAULT_CHANNEL_MODE, #endif + #ifdef DEFAULT_BLINK_CHANNEL + // blink numbers in a specific channel (user configurable) + .blink_channel = DEFAULT_BLINK_CHANNEL, + #endif #endif #ifdef USE_CHANNEL_MODE_ARGS // one byte of extra data per channel mode, like for tint value diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c index 80652b3..1c40b81 100644 --- a/spaghetti-monster/fsm-misc.c +++ b/spaghetti-monster/fsm-misc.c @@ -32,6 +32,11 @@ uint8_t blink_digit(uint8_t num) { uint8_t ontime = BLINK_SPEED * 2 / 12; if (!num) { ontime = 8; num ++; } + #ifdef BLINK_CHANNEL + uint8_t old_channel = CH_MODE; + set_channel_mode(BLINK_CHANNEL); + #endif + for (; num>0; num--) { // TODO: allow setting a blink channel mode per build target set_level(BLINK_BRIGHTNESS); @@ -39,6 +44,11 @@ uint8_t blink_digit(uint8_t num) { set_level(0); nice_delay_ms(BLINK_SPEED * 3 / 12); } + + #ifdef BLINK_CHANNEL + set_channel_mode(old_channel); + #endif + return nice_delay_ms(BLINK_SPEED * 8 / 12); } #endif diff --git a/spaghetti-monster/fsm-misc.h b/spaghetti-monster/fsm-misc.h index 68929c2..8988337 100644 --- a/spaghetti-monster/fsm-misc.h +++ b/spaghetti-monster/fsm-misc.h @@ -9,10 +9,15 @@ void auto_clock_speed(); #endif #if defined(USE_BLINK_NUM) || defined(USE_BLINK_DIGIT) -#ifndef BLINK_BRIGHTNESS -#define BLINK_BRIGHTNESS (MAX_LEVEL/6) -#endif -uint8_t blink_digit(uint8_t num); + #ifndef BLINK_BRIGHTNESS + #define BLINK_BRIGHTNESS (MAX_LEVEL/6) + #endif + #if defined(USE_CFG) && defined(DEFAULT_BLINK_CHANNEL) + #define BLINK_CHANNEL cfg.blink_channel + #elif defined(DEFAULT_BLINK_CHANNEL) + #define BLINK_CHANNEL DEFAULT_BLINK_CHANNEL + #endif + uint8_t blink_digit(uint8_t num); #endif #ifdef USE_BLINK_NUM |
