Skip to content

Commit

Permalink
Updating PR branch to rebase on latest changes, and also save a bit of
Browse files Browse the repository at this point in the history
MCU space on a few lights
  • Loading branch information
SiteRelEnby committed Apr 29, 2024
1 parent 394c196 commit be0361a
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 19 deletions.
10 changes: 10 additions & 0 deletions hw/hank/emisar-2ch/fet/hwdef.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,41 @@ Channel channels[] = {
.set_level = set_level_ch1,
.gradual_tick = gradual_tick_ch1,
.has_args = 0,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // channel 2 only
.set_level = set_level_ch2,
.gradual_tick = gradual_tick_ch2,
.has_args = 0,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // both channels, tied together (max "200%" power)
.set_level = set_level_both,
.gradual_tick = gradual_tick_both,
.has_args = 0,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // both channels, manual blend (max "100%" power)
.set_level = set_level_blend,
.gradual_tick = gradual_tick_blend,
.has_args = 1,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // both channels, auto blend
.set_level = set_level_auto,
.gradual_tick = gradual_tick_auto,
.has_args = 1,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
RGB_AUX_CHANNELS
};
Expand Down
10 changes: 10 additions & 0 deletions hw/hank/emisar-2ch/hwdef.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,41 @@ Channel channels[] = {
.set_level = set_level_ch1,
.gradual_tick = gradual_tick_ch1,
.has_args = 0,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // channel 2 only
.set_level = set_level_ch2,
.gradual_tick = gradual_tick_ch2,
.has_args = 0,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // both channels, tied together (max "200%" power)
.set_level = set_level_both,
.gradual_tick = gradual_tick_both,
.has_args = 0,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // both channels, manual blend (max "100%" power)
.set_level = set_level_blend,
.gradual_tick = gradual_tick_blend,
.has_args = 1,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // both channels, auto blend
.set_level = set_level_auto,
.gradual_tick = gradual_tick_auto,
.has_args = 1,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
RGB_AUX_CHANNELS
};
Expand Down
2 changes: 0 additions & 2 deletions hw/hank/noctigon-kr4/nofet/anduril.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#define HWDEF_C hank/noctigon-kr4/nofet/hwdef.c
#include "hank/noctigon-kr4/anduril.h"

#define USE_AUX_RGB_LEDS_WHILE_ON 1

// brightness w/ SST-20 4000K LEDs:
// 0/1023: 0.35 lm
// 1/1023: 2.56 lm
Expand Down
10 changes: 10 additions & 0 deletions hw/hank/noctigon-m44/hwdef.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,41 @@ Channel channels[] = {
.set_level = set_level_ch1,
.gradual_tick = gradual_tick_ch1,
.has_args = 0,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // channel 2 only
.set_level = set_level_ch2,
.gradual_tick = gradual_tick_ch2,
.has_args = 0,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // both channels, tied together (max "200%" power)
.set_level = set_level_both,
.gradual_tick = gradual_tick_both,
.has_args = 0,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // both channels, manual blend (max "100%" power)
.set_level = set_level_blend,
.gradual_tick = gradual_tick_blend,
.has_args = 1,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // both channels, auto blend
.set_level = set_level_auto,
.gradual_tick = gradual_tick_auto,
.has_args = 1,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
RGB_AUX_CHANNELS
};
Expand Down
5 changes: 0 additions & 5 deletions hw/sofirn/blf-lt1-t1616/hwdef.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,26 @@ Channel channels[] = {
.set_level = set_level_ch1,
.gradual_tick = gradual_tick_ch1,
.has_args = 0,
.uses_aux = 0
},
{ // channel 2 only
.set_level = set_level_ch2,
.gradual_tick = gradual_tick_ch2,
.has_args = 0,
.uses_aux = 0
},
{ // both channels, tied together (max "200%" power)
.set_level = set_level_both,
.gradual_tick = gradual_tick_both,
.has_args = 0,
.uses_aux = 0
},
{ // both channels, manual blend (max "100%" power)
.set_level = set_level_blend,
.gradual_tick = gradual_tick_blend,
.has_args = 1,
.uses_aux = 0
},
{ // both channels, auto blend
.set_level = set_level_auto,
.gradual_tick = gradual_tick_auto,
.has_args = 1,
.uses_aux = 0
},
AUX_CHANNELS
};
Expand Down
5 changes: 0 additions & 5 deletions hw/sofirn/blf-lt1/hwdef.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,26 @@ Channel channels[] = {
.set_level = set_level_ch1,
//.gradual_tick = gradual_tick_ch1,
.has_args = 0,
.uses_aux = 0
},
{ // channel 2 only
.set_level = set_level_ch2,
//.gradual_tick = gradual_tick_ch2,
.has_args = 0,
.uses_aux = 0
},
{ // both channels, tied together (max "200%" power)
.set_level = set_level_both,
//.gradual_tick = gradual_tick_both,
.has_args = 0,
.uses_aux = 0
},
{ // both channels, manual blend (max "100%" power)
.set_level = set_level_blend,
//.gradual_tick = gradual_tick_blend,
.has_args = 1,
.uses_aux = 0
},
{ // both channels, auto blend
.set_level = set_level_blend,
//.gradual_tick = gradual_tick_blend,
.has_args = 1,
.uses_aux = 0
},
};

Expand Down
5 changes: 0 additions & 5 deletions hw/sofirn/lt1s-pro/hwdef.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,26 @@ Channel channels[] = {
.set_level = set_level_white_blend,
.gradual_tick = gradual_tick_white_blend,
.has_args = 1,
.uses_aux = 0
},
{ // auto blend from warm white to cool white
.set_level = set_level_auto_2ch_blend,
.gradual_tick = gradual_tick_auto_2ch_blend,
.has_args = 0,
.uses_aux = 0
},
{ // auto blend from red to warm white to cool white
.set_level = set_level_auto_3ch_blend,
.gradual_tick = gradual_tick_auto_3ch_blend,
.has_args = 0,
.uses_aux = 0
},
{ // red only
.set_level = set_level_red,
.gradual_tick = gradual_tick_red,
.has_args = 0,
.uses_aux = 0
},
{ // manual white blend + adjustable red
.set_level = set_level_red_white_blend,
.gradual_tick = gradual_tick_red_white_blend,
.has_args = 1,
.uses_aux = 0
}
};

Expand Down
4 changes: 4 additions & 0 deletions hw/wurkkos/ts10/hwdef.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ Channel channels[] = {
{ // main LEDs
.set_level = set_level_main,
.gradual_tick = gradual_tick_main,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 0
#endif
},
{ // aux LEDs
.set_level = set_level_aux,
.gradual_tick = gradual_tick_null,
#ifdef USE_CHANNEL_USES_AUX
.uses_aux = 1
#endif
}
};

Expand Down
16 changes: 15 additions & 1 deletion ui/anduril/config-default.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,19 @@
// (but allow disabling this feature per build)
#define USE_CHANNEL_PER_STROBE

// enable channel mode config prerequisites for channel_uses_aux()
// Use channel_uses_aux() where needed and practical to.
// See issue: https://github.com/ToyKeeper/anduril/issues/29
// We want to avoid including this functionality for code size reasons on t85.
// By default there are no t85 builds with RGB aux (it is unlikely to be *able*
// to fit on a t85) - this does leave one known issue, that strobe modes on t85
// lights will be able to be configured to use aux channels, including strobes
// that wouldn't work with aux (e.g. bike flasher or candle mode), but we need
// this for any t1634 or newer light with RGB aux to fix some more significant
// edge cases around RGB, but this also applies to *any* light with aux-based
// channels for the aforementioned issue. This has to be included here because
// we need this to be defined *before* the light-specific anduril.h and hwdefs
// are loaded, as ramp tables could be shared between two lghts with different
// aux configurations.
#if (MCU==0x1634) || (MCU==0x1616) || (MCU==0x32dd20)
#define USE_CHANNEL_USES_AUX
#endif
5 changes: 4 additions & 1 deletion ui/anduril/strobe-modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ uint8_t strobe_state(Event event, uint16_t arg) {
do {
count ++; //e.g. 1
next_ch = ((next_ch + 1) % NUM_CHANNEL_MODES);
if (!channel_uses_aux(next_ch)) break;
#ifdef USE_CHANNEL_USES_AUX // this bugfix is not available without this feature (probably only on t85 without RGB, where it matters less)
//TODO: do something else here to get the same effect, maybe using NUM_CHANNEL_MODES?
if (!channel_uses_aux(next_ch)) break;
#endif
} while (count < NUM_CHANNEL_MODES);
} else {
next_ch = ((channel_mode + 1) % NUM_CHANNEL_MODES);
Expand Down

0 comments on commit be0361a

Please sign in to comment.