Skip to content

Commit

Permalink
Prevent selecting aux channels in strobes needing brightness control
Browse files Browse the repository at this point in the history
This prevents a user from 3Cing into an aux channel while in one of
these strobes (candle mode and bike flasher) where they will just get
solid aux as a result, while still allowing aux channels to be used
for strobes where it might make sense (e.g. lightning, tac strobe).

Also added uses_aux to the TS10v1 aux channel which I forgot before.
  • Loading branch information
SiteRelEnby authored and stcarlso committed Apr 24, 2024
1 parent 8ea5643 commit 95f0f20
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
6 changes: 4 additions & 2 deletions hw/wurkkos/ts10/hwdef.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ bool gradual_tick_main(uint8_t gt);
Channel channels[] = {
{ // main LEDs
.set_level = set_level_main,
.gradual_tick = gradual_tick_main
.gradual_tick = gradual_tick_main,
.uses_aux = 0
},
{ // aux LEDs
.set_level = set_level_aux,
.gradual_tick = gradual_tick_null
.gradual_tick = gradual_tick_null,
.uses_aux = 1
}
};

Expand Down
31 changes: 29 additions & 2 deletions ui/anduril/strobe-modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,35 @@ uint8_t strobe_state(Event event, uint16_t arg) {
#if (NUM_CHANNEL_MODES > 1) && defined(USE_CHANNEL_PER_STROBE)
// 3 clicks: rotate through channel modes for the current strobe
else if (event == EV_3clicks) {
// TODO: maybe skip aux modes?
set_channel_mode((channel_mode + 1) % NUM_CHANNEL_MODES);
uint8_t next_ch = (channel_mode);
// TODO: police flasher mode isn't handled by this, doesn't really matter as it sets modes anyway,
// but maybe should do something sensible to handle it here as well?
#if (defined(USE_BIKE_FLASHER_MODE) || defined(USE_CANDLE_MODE))
if (
#ifdef USE_BIKE_FLASHER_MODE
(current_strobe_type == bike_flasher_e)
#ifdef USE_CANDLE_MODE
||
#endif
#endif
#ifdef USE_CANDLE_MODE
(current_strobe_type == candle_mode_e)
#endif
){
// uint8_t next_ch = (channel_mode);
uint8_t count = 0;
do {
count ++; //e.g. 1
next_ch = ((next_ch + 1) % NUM_CHANNEL_MODES);
if (!channel_uses_aux(next_ch)) break;
} while (count < NUM_CHANNEL_MODES);
} else {
next_ch = ((channel_mode + 1) % NUM_CHANNEL_MODES);
}
set_channel_mode(next_ch);
#else
set_channel_mode((channel_mode + 1) % NUM_CHANNEL_MODES);
#endif
cfg.strobe_channels[st] = channel_mode;
save_config();
return EVENT_HANDLED;
Expand Down

0 comments on commit 95f0f20

Please sign in to comment.