diff options
| author | Selene ToyKeeper | 2024-08-19 13:10:04 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2024-08-19 13:10:04 -0600 |
| commit | 4c2bbf92194ff5f41a87baa95c5388b325a27d2d (patch) | |
| tree | 2d2b51fc3ef800e55009bc5f01ef7119d4c32d6e /ui | |
| parent | ts25-boost: reduced visible PWM, made party strobe less blurry (diff) | |
| parent | removed "Off -> 3H" strobe/mood mode access from Extended Simple UI (diff) | |
| download | anduril-4c2bbf92194ff5f41a87baa95c5388b325a27d2d.tar.gz anduril-4c2bbf92194ff5f41a87baa95c5388b325a27d2d.tar.bz2 anduril-4c2bbf92194ff5f41a87baa95c5388b325a27d2d.zip | |
Merge branch 'trunk' into wurkkos-ts25-boost
# By Selene ToyKeeper (20) and others
* trunk: (25 commits)
removed "Off -> 3H" strobe/mood mode access from Extended Simple UI
include hardware-specific readme files in the release .zip
added change log for 2024-04-20 release
Forgot to update model count after the last couple additions
use low aux for chan-aux level 0
MODELS: added emisar-d3aa
make-release.sh should use version-string.sh instead of duplicating code
d3aa: fixed voltage calculation to use 0.02V units instead of 0.025V
d3aa weak battery test: blink 3x instead of 2x, and omit number readout
use smooth steps in lockout mode, if enabled
fixed Tactical Mode's strobes when Momentary Mode not enabled
increased voltage precision from 0.025V to 0.02V (so 0 to 255 now goes from 0.00V to 5.10V)
weak battery detection: use different thresholds for AA and Li-Ion (also, fixed bug where a totally empty li-ion didn't get limited)
d3aa: got weak battery detection actually working, and not letting the magic smoke out of updi adapters any more (probably)
dammit, got alkaline detection half working and then my flashing adapter died (saving progress here so I can work on a different branch)
fixed inaccurate comment (thanks to xikteny for spotting it)
d3aa fine-tuning: - new ramp - production style config defaults (simple mode, Hank config) - candle tuning - fixed way-too-fast thermal regulation (might still be a bit fast, but it's a lot better)
d3aa: fixed voltage measurement
Allow manually running GitHub actions workflows
Bugfix: Prevent switching channel modes when in tactical mode
...
# Conflicts:
# arch/attiny1616.c (fixed)
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/anduril/anduril.c | 24 | ||||
| -rw-r--r-- | ui/anduril/aux-leds.c | 39 | ||||
| -rw-r--r-- | ui/anduril/lockout-mode.c | 4 | ||||
| -rw-r--r-- | ui/anduril/off-mode.c | 26 | ||||
| -rw-r--r-- | ui/anduril/strobe-modes.c | 2 | ||||
| -rw-r--r-- | ui/anduril/tactical-mode.c | 5 |
6 files changed, 56 insertions, 44 deletions
diff --git a/ui/anduril/anduril.c b/ui/anduril/anduril.c index 1cdb8d0..a7e4199 100644 --- a/ui/anduril/anduril.c +++ b/ui/anduril/anduril.c @@ -121,7 +121,7 @@ #include "anduril/lockout-mode.h" #endif -#ifdef USE_MOMENTARY_MODE +#if (defined(USE_MOMENTARY_MODE) || defined(USE_TACTICAL_MODE)) #include "anduril/momentary-mode.h" #endif @@ -189,7 +189,7 @@ #include "anduril/lockout-mode.c" #endif -#ifdef USE_MOMENTARY_MODE +#if (defined(USE_MOMENTARY_MODE) || defined(USE_TACTICAL_MODE)) #include "anduril/momentary-mode.c" #endif @@ -225,8 +225,16 @@ void setup() { // regular e-switch light, no hard clicky power button - // blink at power-on to let user know power is connected - blink_once(); + #ifdef USE_WEAK_BATTERY_PROTECTION + // try to measure the battery strength + // (must be done *before* factory reset, + // because reset tries to use full power, + // and a weak battery can't do that) + detect_weak_battery(); + #else + // blink at power-on to let user know power is connected + blink_once(); + #endif #ifdef USE_FACTORY_RESET if (button_is_pressed()) @@ -293,10 +301,12 @@ void loop() { #ifdef USE_STROBE_STATE else if ((state == strobe_state) - #ifdef USE_MOMENTARY_MODE + #if defined(USE_MOMENTARY_MODE) || defined(USE_TACTICAL_MODE) // also handle momentary strobes - || (( - (state == momentary_state) + || ((0 + #ifdef USE_MOMENTARY_MODE + || (state == momentary_state) + #endif #ifdef USE_TACTICAL_MODE || (state == tactical_state) #endif diff --git a/ui/anduril/aux-leds.c b/ui/anduril/aux-leds.c index fd184fc..7356666 100644 --- a/ui/anduril/aux-leds.c +++ b/ui/anduril/aux-leds.c @@ -58,27 +58,27 @@ void indicator_led_update(uint8_t mode, uint8_t tick) { uint8_t voltage_to_rgb() { static const uint8_t levels[] = { // voltage, color - 0, 0, // black + 0, 0, // black #ifdef DUAL_VOLTAGE_FLOOR // AA / NiMH voltages - 4* 9, 1, // R - 4*10, 2, // R+G - 4*11, 3, // G - 4*12, 4, // G+B - 4*13, 5, // B - 4*14, 6, // R + B - 4*16, 7, // R+G+B - 4*20, 0, // black + 9*dV, 1, // R + 10*dV, 2, // R+G + 11*dV, 3, // G + 12*dV, 4, // G+B + 13*dV, 5, // B + 14*dV, 6, // R + B + 16*dV, 7, // R+G+B + 20*dV, 0, // black #endif // li-ion voltages - 4*29, 1, // R - 4*33, 2, // R+G - 4*35, 3, // G - 4*37, 4, // G+B - 4*39, 5, // B - 4*41, 6, // R + B - 4*44, 7, // R+G+B // skip; looks too similar to G+B - 255, 7, // R+G+B + 29*dV, 1, // R + 33*dV, 2, // R+G + 35*dV, 3, // G + 37*dV, 4, // G+B + 39*dV, 5, // B + 41*dV, 6, // R + B + 44*dV, 7, // R+G+B // skip; looks too similar to G+B + 255, 7, // R+G+B }; uint8_t volts = voltage; //if (volts < VOLTAGE_LOW) return 0; @@ -151,11 +151,8 @@ void rgb_led_update(uint8_t mode, uint16_t arg) { else { // voltage // show actual voltage while asleep... if (go_to_standby) { - actual_color = voltage_to_rgb(); // choose a color based on battery voltage - //if (volts >= 38) actual_color = pgm_read_byte(colors + 4); - //else if (volts >= 33) actual_color = pgm_read_byte(colors + 2); - //else actual_color = pgm_read_byte(colors + 0); + actual_color = voltage_to_rgb(); } // ... but during preview, cycle colors quickly else { diff --git a/ui/anduril/lockout-mode.c b/ui/anduril/lockout-mode.c index 6f85ca9..c3f82ea 100644 --- a/ui/anduril/lockout-mode.c +++ b/ui/anduril/lockout-mode.c @@ -26,11 +26,11 @@ uint8_t lockout_state(Event event, uint16_t arg) { if (cfg.manual_memory) lvl = cfg.manual_memory; #endif } - set_level(lvl); + off_state_set_level(lvl); } // button was released else if ((event & (B_CLICK | B_PRESS)) == (B_CLICK)) { - set_level(0); + off_state_set_level(0); } #endif // ifdef USE_MOON_DURING_LOCKOUT_MODE diff --git a/ui/anduril/off-mode.c b/ui/anduril/off-mode.c index 36d771c..f699c89 100644 --- a/ui/anduril/off-mode.c +++ b/ui/anduril/off-mode.c @@ -264,19 +264,6 @@ uint8_t off_state(Event event, uint16_t arg) { #endif // ifndef USE_EXTENDED_SIMPLE_UI #endif // ifdef USE_SIMPLE_UI - // click, click, long-click: strobe mode - #ifdef USE_STROBE_STATE - else if (event == EV_click3_hold) { - set_state(strobe_state, 0); - return EVENT_HANDLED; - } - #elif defined(USE_BORING_STROBE_STATE) - else if (event == EV_click3_hold) { - set_state(boring_strobe_state, 0); - return EVENT_HANDLED; - } - #endif - #ifdef USE_INDICATOR_LED // 7 clicks: change indicator LED mode else if (event == EV_7clicks) { @@ -334,6 +321,19 @@ uint8_t off_state(Event event, uint16_t arg) { } #endif // ifdef USE_EXTENDED_SIMPLE_UI + // click, click, long-click: strobe mode + #ifdef USE_STROBE_STATE + else if (event == EV_click3_hold) { + set_state(strobe_state, 0); + return EVENT_HANDLED; + } + #elif defined(USE_BORING_STROBE_STATE) + else if (event == EV_click3_hold) { + set_state(boring_strobe_state, 0); + return EVENT_HANDLED; + } + #endif + // 10 clicks: enable simple UI else if (event == EV_10clicks) { blink_once(); diff --git a/ui/anduril/strobe-modes.c b/ui/anduril/strobe-modes.c index ccc4aa0..38e4dca 100644 --- a/ui/anduril/strobe-modes.c +++ b/ui/anduril/strobe-modes.c @@ -13,7 +13,7 @@ uint8_t strobe_state(Event event, uint16_t arg) { // 'st' reduces ROM size slightly strobe_mode_te st = current_strobe_type; - #ifdef USE_MOMENTARY_MODE + #if defined(USE_MOMENTARY_MODE) || defined(USE_TACTICAL_MODE) momentary_mode = 1; // 0 = ramping, 1 = strobes #endif diff --git a/ui/anduril/tactical-mode.c b/ui/anduril/tactical-mode.c index 5acd902..002f917 100644 --- a/ui/anduril/tactical-mode.c +++ b/ui/anduril/tactical-mode.c @@ -68,6 +68,11 @@ uint8_t tactical_state(Event event, uint16_t arg) { return lockout_state(event, arg); } + // handle 3C here to prevent changing channel modes unintentionally + if (event == EV_3clicks) { + return EVENT_HANDLED; + } + // 6 clicks: exit and turn off else if (event == EV_6clicks) { blink_once(); |
