diff options
Diffstat (limited to '')
| -rw-r--r-- | spaghetti-monster/anduril/anduril-manual.txt | 195 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/channel-modes.c | 55 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/channel-modes.h | 6 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/config-default.h | 4 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/load-save-config-fsm.h | 3 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/load-save-config.h | 3 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/ramp-mode-fsm.h | 3 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/ramp-mode.c | 8 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/ramp-mode.h | 2 |
9 files changed, 227 insertions, 52 deletions
diff --git a/spaghetti-monster/anduril/anduril-manual.txt b/spaghetti-monster/anduril/anduril-manual.txt index 1873b8d..fc61948 100644 --- a/spaghetti-monster/anduril/anduril-manual.txt +++ b/spaghetti-monster/anduril/anduril-manual.txt @@ -279,8 +279,9 @@ more than 2 times when the light is off: - 3H: Strobe modes, starting with the most recently used strobe. - 4C: Lockout mode. - 5C: Momentary mode. + - 6C: Tactical mode. - 7C / 7H: Aux LED configuration. - - 9H: Misc configuration menu. (only on some lights) + - 9H: Misc Config menu. (only on some lights) - 10H: Simple UI configuration menu. - 13H: Factory reset (on some lights). - 15C or more: Version check. @@ -485,6 +486,11 @@ In more detail, here is what each mode does: Be careful about heat in this mode, if using it for a long time. + - Police strobe (on some lights) + + 2-color police style strobe. Only works on lights with 2 or more + colors. + - Lightning storm mode Flashes at random brightness and random speed to simulate lightning @@ -519,6 +525,46 @@ To exit this mode, physically disconnect power by unscrewing the tailcap or battery tube. +Tactical Mode +-------------- + +Click 6 times from Off to enter Tactical Mode, or 6 times in Tactical +Mode to exit and go back to "Off". + +Tactical Mode provides instant momentary access to high, low, and +strobe, but each of these is configurable. The inputs are: + + - 1H: High + - 2H: Low + - 3H: Strobe + +Each of these only lasts as long as you hold the button. + +Other commands in Tactical Mode are: + + - 6C: exit (go back to Off Mode) + - 7H: Tactical Mode config menu + - 1st blink: configure tactical slot 1 + - 2nd blink: configure tactical slot 2 + - 3rd blink: configure tactical slot 3 + +To change what is in a tactical slot, press 7H, then release the button +after the 1st, 2nd, or 3rd blink. Then enter a number. Each click adds +1, and each hold adds 10. The number can be: + + - 1 to 150: set the brightness level + - 0: last-used strobe mode + - 151+: go directly to a specific strobe mode + 151 = party strobe + 152 = tactical strobe + 153+ = other strobes, in the same order they're in in the "Off -> 3H" + strobe group + +This assumes the light has a ramp 150 levels long. Strobe modes start +at the ramp size plus 1, so it may be different if a light has a +different ramp size. + + Configuration Menus ------------------- @@ -693,14 +739,18 @@ Misc Config Menu ---------------- Some models may have an extra config menu for settings which don't fit -anywhere else. These settings are, in order: +anywhere else. This menu is located at "Off -> 9H" in the advanced UI. - - Tint ramp style: +These settings are, in order: - 0 = smooth (blend channels in any proportion) - 1 = toggle (only one channel active at a time) + - Tint ramp style: (on some lights) - - Jump Start level: + 0 : smooth ramp (blend channels in any proportion) + 1 : middle tint only + 2 : extreme tints only (only one channel active at a time) + 3+: stepped ramp with 3+ steps + + - Jump Start level: (on some lights) Some lights are prone to starting up slowly at low levels, so they have an option to "jump start" the engine by pulsing a higher power @@ -710,36 +760,71 @@ anywhere else. These settings are, in order: The value can be from 1 to 150, but is usually between 20 and 50. These settings are hardware-specific and may not be present on all -lights. The number of settings in the global menu depends on the +lights. The number of settings in the Misc Config Menu depends on the hardware model and the firmware version. -Tint Ramping ------------- +Channel Modes (a.k.a. Tint Ramping or Multi Channel controls) +------------------------------------------------------------- Some lights have more than one set of LEDs which can be adjusted to -change the color temperature of the light. On these models, there is a -global button mapping which works at all times unless it's overridden by -the mode the light is in: +change the beam color, shape, or other properties. These lights have +features like tint ramping and channel modes. + +On these models, there are some global button mappings which work at all +times unless they're overridden by the mode the light is in: + + - 3C: Next channel mode + - 3H: Adjust current channel mode (ramp tint, for example) + - 9H: Channel mode config menu - - 3H: Tint ramping +Details depend on the exact type of light used. For example, if a light +has LEDs in cool white, warm white, and red... that light might have a +few channel modes: -So, at almost any time, click 3 times but hold the final press, and it -can change the color of the light. This is best done with the light at -a moderately high level, because it makes the changes smooth. Low -levels have more coarse resolution and will typically change in very -visible steps. + - White blend (adjustable CCT / tint ramping) + - Red only + - Auto-tint -At both ends of the tint ramp, there is an "auto tint" mode. This -automatically chooses a tint based on the brightness level... so it can -be warm white while dim, or cool white while bright. Or vice-versa. To -access this, ramp to the end of the tint range, then keep holding until -the light blinks a second time. +On a light like this, the user could press 3C to rotate through these +different channel modes... white, then red, then auto, then back to +white. + +Additionally, in the "white blend" mode, the user could press 3H to +manually adjust the balance between warm white and cool white. + +Finally, if the user decides they don't want all of the modes, they can +turn some off. Press 9H (while on) to start the channel mode config +menu. To disable the auto-tint mode, for example, it is the 3rd mode... +so wait for the 3rd blink, then release the button. Then at the prompt, +enter a value of 0 (wait for the prompt to time out without clicking +anything). Afterward, the auto tint mode should no longer be in the +channel mode rotation. To turn the mode back on later, do the same +thing, but enter a value of 1 (click 1 time at the prompt). + +A light can have many different channel modes, so don't be shy about +turning off any modes you don't use. It makes all the others easier to +reach. + +If you turn off channel modes until only 1 remains, the "Ramp -> 3C" +action reverts to its single-channel behavior -- switching between a +smooth or stepped brightness ramp. Additionally, when a channel mode +has nothing to adjust with 3H, the 3H action also reverts to its +single-channel behavior -- momentary turbo. + +The Misc Config Menu (Off -> 9H) may also have a setting to choose a +tint ramp style. There are a few styles available, by entering +different numbers into that config menu: + + 0: smooth ramp + 1: middle tint only + 2: extreme tints only + 3+: stepped ramp with 3+ steps + +This setting only applies to modes with channel ramping (i.e. tint +ramping), and only when that mode uses the default 3H event handler. +Custom channel modes may work differently. -The misc config menu also has a setting to choose a tint ramp style. -This can be smooth, allowing the user to smoothly blend both channels in -whatever ratio they desire... or it can be "tint toggle" style, where -only one channel is active at a time. UI Reference Table @@ -758,9 +843,12 @@ Off Any 3C Battcheck mode Off Full 3H Strobe mode (whichever was used last) Off Any 4C Lockout mode Off Full 5C Momentary mode +Off Full 6C Tactical mode Off Full 7C Aux LEDs: Next pattern Off Full 7H Aux LEDs: Next color -Off Full 9H Misc config menu (varies per light) +Off Full 9H Misc Config menu (varies per light): + ?1: tint ramp style + ?2: jump start level Off Full 10C Enable Simple UI Off Simple 10H Disable Simple UI Off Full 10H Simple UI ramp config menu: @@ -776,19 +864,29 @@ Ramp Any 1H Ramp (up, with reversing) Ramp Any 2H Ramp (down) Ramp Any 2C Go to/from ceiling or turbo (configurable) Ramp Full 3C Change ramp style (smooth / stepped) -Ramp Any 3H Tint ramping (on some lights) -Ramp Full 3H Momentary turbo (on lights without tint ramping) +Ramp Full 6C (same as above, but on multi-channel lights) +Ramp Full 3H Momentary turbo (when no tint ramping) +Ramp Full 4H Momentary turbo (on multi channel lights) 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: speed/steps) +Ramp Full 7H Ramp config menu: (for current ramp) + 1: floor + 2: ceiling + 3: speed / steps Ramp Full 10C Turn on manual memory and save current brightness Ramp Full 10H Ramp Extras config menu: - 1: enable automatic mem + 1: switch to automatic mem, not manual mem 2: set manual mem timeout 3: ramp after moon or not 4: advanced UI turbo style +Multi-channel lights only: +Any Any 3C Next channel mode (i.e. next color mode) +Any Any 3H Tint ramp (if this mode can) +Any Full 9H Channel mode enable/disable menu: + N: click (or not) to enable (disable) mode N + Lockout Any 1C/1H Momentary moon (lowest floor) Lockout Any 2C/2H Momentary moon (highest floor, or manual mem level) Lockout Any 3C Unlock (go to "Off" mode) @@ -797,27 +895,39 @@ Lockout Any 4H On (ramp mode, floor level) Lockout Any 5C On (ramp mode, ceiling level) Lockout Full 7C Aux LEDs: Next pattern Lockout Full 7H Aux LEDs: Next color -Lockout Full 10H Auto-lock config menu (1: set timeout) +Lockout Full 10H Auto-lock config menu: + 1: set timeout in minutes (0 = no auto-lock) Strobe (any) Full 1C Off Strobe (any) Full 2C Next strobe mode -Strobe (any) Full 3H Tint ramping (on some lights) +Strobe (any) Full 4C Prev strobe mode Strobe (any) Full 5C Momentary mode (using current strobe) -Candle Full 1H/2H Brighter / dimmer -Candle Full 5H Sunset timer on, add 5 minutes Party strobe Full 1H/2H Faster / slower Tactical strobe Full 1H/2H Faster / slower -Biking Full 1H/2H Brighter / dimmer +Police strobe - - None (brightness is Ramp Mode's last-used level) Lightning Full 1H Interrupt current flash or start new one +Candle Full 1H/2H Brighter / dimmer +Candle Full 5H Sunset timer on, add 5 minutes +Biking Full 1H/2H Brighter / dimmer Batt check Any 1C Off Batt check Full 2C Next blinky mode (Temp check, Beacon, SOS) Batt check Full 7H Voltage config menu + 1: voltage correction factor + ... + 5: -0.10V + 6: -0.05V + 7: no correction + 8: +0.05V + 9: +0.10V + ... Temp check Full 1C Off Temp check Full 2C Next blinky mode (Beacon, SOS, Batt check) Temp check Full 7H Thermal config menu + 1: set current temperature + 2: set temperature limit Beacon Full 1C Off Beacon Full 1H Configure beacon timing @@ -829,8 +939,19 @@ SOS Full 2C Next blinky mode (Batt check, Temp check, Beacon) Momentary Full Any On (until button is released) Momentary Full Disconnect power Exit Momentary mode +Tactical Full 1H High (tactical slot 1) +Tactical Full 2H Low (tactical slot 2) +Tactical Full 3H Strobe (tactical slot 3) +Tactical Full 6C Exit (go back to Off Mode) +Tactical Full 7H Tactical Mode config menu: + 1: tactical slot 1 + 2: tactical slot 2 + 3: tactical slot 3 + Config menus Full Hold Skip current item with no changes Config menus Full Release Configure current item + (goes to Number Entry menu) Number entry Full Click Add 1 to value for current item Number entry Full Hold Add 10 to value for current item + diff --git a/spaghetti-monster/anduril/channel-modes.c b/spaghetti-monster/anduril/channel-modes.c index 51f294c..b2985a1 100644 --- a/spaghetti-monster/anduril/channel-modes.c +++ b/spaghetti-monster/anduril/channel-modes.c @@ -70,13 +70,25 @@ uint8_t channel_mode_state(Event event, uint16_t arg) { // ignore event if we weren't the ones who handled the first frame if (! active) return EVENT_NOT_HANDLED; - // change normal tints - if ((tint_ramp_direction > 0) && (tint < 255)) { - tint += 1; - } - else if ((tint_ramp_direction < 0) && (tint > 0)) { - tint -= 1; - } + #ifdef USE_STEPPED_TINT_RAMPING + if ((tint_ramp_direction > 0 && tint < 255) || + (tint_ramp_direction < 0 && tint > 0)) { + // ramp slower in stepped mode + if (cfg.tint_ramp_style && (arg % HOLD_TIMEOUT != 0)) + return EVENT_HANDLED; + + const uint8_t step_size = (cfg.tint_ramp_style < 2) + ? 1 : 254 / (cfg.tint_ramp_style-1); + tint = nearest_tint_value( + tint + ((int16_t)step_size * tint_ramp_direction) + ); + } + #else // smooth tint ramping only + if ((tint_ramp_direction > 0) && (tint < 255)) { tint ++; } + else + if ((tint_ramp_direction < 0) && (tint > 0)) { tint --; } + #endif // ifdef USE_STEPPED_TINT_RAMPING + // if tint change stalled, let user know we hit the edge else if (prev_tint == tint) { if (past_edge_counter == 0) blip(); @@ -124,6 +136,7 @@ uint8_t channel_mode_state(Event event, uint16_t arg) { return EVENT_NOT_HANDLED; } + #if NUM_CHANNEL_MODES > 1 void channel_mode_config_save(uint8_t step, uint8_t value) { // 1 menu item per channel mode, to enable or disable that mode @@ -142,3 +155,31 @@ uint8_t channel_mode_config_state(Event event, uint16_t arg) { } #endif + +#if defined(USE_CHANNEL_MODE_ARGS) && defined(USE_STEPPED_TINT_RAMPING) +uint8_t nearest_tint_value(const int16_t target) { + // const symbols for more readable code, will be removed by the compiler + const uint8_t tint_min = 0; + const uint8_t tint_max = 255; + const uint8_t tint_range = tint_max - tint_min; + + // only equal mix of both channels + if (1 == cfg.tint_ramp_style) return (tint_min + tint_max) >> 1; + + if (target < tint_min) return tint_min; + if (target > tint_max) return tint_max; + if (0 == cfg.tint_ramp_style) return target; // smooth ramping + + const uint8_t step_size = tint_range / (cfg.tint_ramp_style-1); + + uint8_t tint_result = tint_min; + for (uint8_t i=0; i<cfg.tint_ramp_style; i++) { + tint_result = tint_min + + (i * (uint16_t)tint_range / (cfg.tint_ramp_style-1)); + int16_t diff = target - tint_result; + if (diff <= (step_size>>1)) return tint_result; + } + return tint_result; +} +#endif + diff --git a/spaghetti-monster/anduril/channel-modes.h b/spaghetti-monster/anduril/channel-modes.h index 67d6bbb..4c16281 100644 --- a/spaghetti-monster/anduril/channel-modes.h +++ b/spaghetti-monster/anduril/channel-modes.h @@ -10,3 +10,9 @@ uint8_t channel_mode_state(Event event, uint16_t arg); #if NUM_CHANNEL_MODES > 1 uint8_t channel_mode_config_state(Event event, uint16_t arg); #endif + +#if defined(USE_CHANNEL_MODE_ARGS) && defined(USE_STEPPED_TINT_RAMPING) +// calculate the nearest tint value which would be valid at the moment +uint8_t nearest_tint_value(const int16_t target); +#endif + diff --git a/spaghetti-monster/anduril/config-default.h b/spaghetti-monster/anduril/config-default.h index 514b9a8..5023c3b 100644 --- a/spaghetti-monster/anduril/config-default.h +++ b/spaghetti-monster/anduril/config-default.h @@ -181,3 +181,7 @@ // those oscillations //#define USE_LOWPASS_WHILE_ASLEEP +// if there's tint ramping, allow user to set it smooth or stepped +#define USE_STEPPED_TINT_RAMPING +#define DEFAULT_TINT_RAMP_STYLE 0 // smooth + diff --git a/spaghetti-monster/anduril/load-save-config-fsm.h b/spaghetti-monster/anduril/load-save-config-fsm.h index ef079db..ceb9d76 100644 --- a/spaghetti-monster/anduril/load-save-config-fsm.h +++ b/spaghetti-monster/anduril/load-save-config-fsm.h @@ -59,6 +59,9 @@ typedef struct Config { #ifdef USE_MANUAL_MEMORY uint8_t manual_memory_channel_args[NUM_CHANNEL_MODES]; #endif + #ifdef USE_STEPPED_TINT_RAMPING + uint8_t tint_ramp_style; + #endif #endif ///// strobe / blinky mode settings diff --git a/spaghetti-monster/anduril/load-save-config.h b/spaghetti-monster/anduril/load-save-config.h index 9fe24c7..60612d3 100644 --- a/spaghetti-monster/anduril/load-save-config.h +++ b/spaghetti-monster/anduril/load-save-config.h @@ -85,6 +85,9 @@ Config cfg = { // remember and reset 1 extra parameter per channel mode (like tint) .manual_memory_channel_args = { CHANNEL_MODE_ARGS }, #endif + #ifdef USE_STEPPED_TINT_RAMPING + .tint_ramp_style = DEFAULT_TINT_RAMP_STYLE, + #endif #endif ///// strobe / blinky mode settings diff --git a/spaghetti-monster/anduril/ramp-mode-fsm.h b/spaghetti-monster/anduril/ramp-mode-fsm.h index 8fb80d1..edfd6db 100644 --- a/spaghetti-monster/anduril/ramp-mode-fsm.h +++ b/spaghetti-monster/anduril/ramp-mode-fsm.h @@ -31,7 +31,8 @@ #endif // include an extra config mode for random stuff which doesn't fit elsewhere -#if defined(USE_TINT_RAMPING) || defined(USE_JUMP_START) +#if defined(USE_JUMP_START) || \ + (defined(USE_CHANNEL_MODE_ARGS) && defined(USE_STEPPED_TINT_RAMPING)) #define USE_GLOBALS_CONFIG #endif diff --git a/spaghetti-monster/anduril/ramp-mode.c b/spaghetti-monster/anduril/ramp-mode.c index 5a960c9..1799e97 100644 --- a/spaghetti-monster/anduril/ramp-mode.c +++ b/spaghetti-monster/anduril/ramp-mode.c @@ -587,12 +587,8 @@ uint8_t ramp_extras_config_state(Event event, uint16_t arg) { #ifdef USE_GLOBALS_CONFIG void globals_config_save(uint8_t step, uint8_t value) { if (0) {} - #ifdef USE_TINT_RAMPING - else if (step == 1+tint_style_config_step) { - tint_style = !(!(value)); - // set tint to middle or edge depending on style being smooth or toggle - tint = tint_style ? 1 : 127; - } + #if defined(USE_CHANNEL_MODE_ARGS) && defined(USE_STEPPED_TINT_RAMPING) + else if (step == 1+tint_style_config_step) { cfg.tint_ramp_style = value; } #endif #ifdef USE_JUMP_START else if (step == 1+jump_start_config_step) { cfg.jump_start_level = value; } diff --git a/spaghetti-monster/anduril/ramp-mode.h b/spaghetti-monster/anduril/ramp-mode.h index e4ded1e..20986cc 100644 --- a/spaghetti-monster/anduril/ramp-mode.h +++ b/spaghetti-monster/anduril/ramp-mode.h @@ -188,7 +188,7 @@ void reset_sunset_timer(); #ifdef USE_GLOBALS_CONFIG typedef enum { - #ifdef USE_TINT_RAMPING + #if defined(USE_CHANNEL_MODE_ARGS) && defined(USE_STEPPED_TINT_RAMPING) tint_style_config_step, #endif #ifdef USE_JUMP_START |
