diff options
| author | Selene ToyKeeper | 2023-08-24 17:08:01 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2023-08-24 17:08:01 -0600 |
| commit | 04a48e44b25d1c42dc26f837586a7503bb74b749 (patch) | |
| tree | fb4b0536ef8d9b05fa606d5ab082a30addf08781 /hw | |
| parent | fixed issue where tactical mode overrode strobe group memory (diff) | |
| download | anduril-04a48e44b25d1c42dc26f837586a7503bb74b749.tar.gz anduril-04a48e44b25d1c42dc26f837586a7503bb74b749.tar.bz2 anduril-04a48e44b25d1c42dc26f837586a7503bb74b749.zip | |
added channel mode per strobe mode, and made FSM channel mode more flexible,
and fixed issue in tactical mode where strobes wouldn't stop on button release
Diffstat (limited to '')
| -rw-r--r-- | hwdef-emisar-2ch-fet.c | 8 | ||||
| -rw-r--r-- | hwdef-emisar-2ch.c | 8 | ||||
| -rw-r--r-- | hwdef-noctigon-m44.c | 8 | ||||
| -rw-r--r-- | hwdef-sofirn-lt1s-pro.c | 12 |
4 files changed, 18 insertions, 18 deletions
diff --git a/hwdef-emisar-2ch-fet.c b/hwdef-emisar-2ch-fet.c index ea4f5e6..7cf48d3 100644 --- a/hwdef-emisar-2ch-fet.c +++ b/hwdef-emisar-2ch-fet.c @@ -134,7 +134,7 @@ void set_level_blend(uint8_t level) { //uint16_t brightness = PWM_GET8 (pwm1_levels, level) << 1; uint16_t brightness = PWM_GET8 (pwm1_levels, level) + pwm3; uint16_t top = PWM_GET16(pwm3_levels, level); - uint8_t blend = cfg.channel_mode_args[cfg.channel_mode]; + uint8_t blend = cfg.channel_mode_args[channel_mode]; calc_2ch_blend(&pwm1, &pwm2, brightness, top, blend); @@ -150,7 +150,7 @@ void set_level_auto(uint8_t level) { uint8_t brightness = PWM_GET8 (pwm4_levels, level); uint16_t top = PWM_GET16(pwm5_levels, level); uint8_t blend = 255 * (uint16_t)level / RAMP_SIZE; - if (cfg.channel_mode_args[cfg.channel_mode] & 0b01000000) + if (cfg.channel_mode_args[channel_mode] & 0b01000000) blend = 255 - blend; calc_2ch_blend(&pwm1, &pwm2, brightness, top, blend); @@ -197,7 +197,7 @@ bool gradual_tick_blend(uint8_t level) { //uint16_t brightness = PWM_GET8 (pwm1_levels, level) << 1; uint16_t brightness = PWM_GET8 (pwm1_levels, level) + pwm3; uint16_t top = PWM_GET16(pwm3_levels, level); - uint8_t blend = cfg.channel_mode_args[cfg.channel_mode]; + uint8_t blend = cfg.channel_mode_args[channel_mode]; calc_2ch_blend(&pwm1, &pwm2, brightness, top, blend); @@ -209,7 +209,7 @@ bool gradual_tick_auto(uint8_t level) { uint8_t brightness = PWM_GET8 (pwm4_levels, level); uint16_t top = PWM_GET16(pwm5_levels, level); uint8_t blend = 255 * (uint16_t)level / RAMP_SIZE; - if (cfg.channel_mode_args[cfg.channel_mode] & 0b01000000) + if (cfg.channel_mode_args[channel_mode] & 0b01000000) blend = 255 - blend; calc_2ch_blend(&pwm1, &pwm2, brightness, top, blend); diff --git a/hwdef-emisar-2ch.c b/hwdef-emisar-2ch.c index 793e9bc..7955cf6 100644 --- a/hwdef-emisar-2ch.c +++ b/hwdef-emisar-2ch.c @@ -128,7 +128,7 @@ void set_level_blend(uint8_t level) { PWM_DATATYPE ch1_pwm, ch2_pwm; PWM_DATATYPE brightness = PWM_GET(pwm1_levels, level); PWM_DATATYPE top = PWM_GET(pwm_tops, level); - uint8_t blend = cfg.channel_mode_args[cfg.channel_mode]; + uint8_t blend = cfg.channel_mode_args[channel_mode]; calc_2ch_blend(&ch1_pwm, &ch2_pwm, brightness, top, blend); @@ -144,7 +144,7 @@ void set_level_auto(uint8_t level) { PWM_DATATYPE brightness = PWM_GET(pwm1_levels, level); PWM_DATATYPE top = PWM_GET(pwm_tops, level); uint8_t blend = 255 * (uint16_t)level / RAMP_SIZE; - if (cfg.channel_mode_args[cfg.channel_mode] & 0b01000000) + if (cfg.channel_mode_args[channel_mode] & 0b01000000) blend = 255 - blend; calc_2ch_blend(&ch1_pwm, &ch2_pwm, brightness, top, blend); @@ -185,7 +185,7 @@ bool gradual_tick_blend(uint8_t gt) { PWM_DATATYPE ch1_pwm, ch2_pwm; PWM_DATATYPE brightness = PWM_GET(pwm1_levels, gt); PWM_DATATYPE top = PWM_GET(pwm_tops, gt); - uint8_t blend = cfg.channel_mode_args[cfg.channel_mode]; + uint8_t blend = cfg.channel_mode_args[channel_mode]; calc_2ch_blend(&ch1_pwm, &ch2_pwm, brightness, top, blend); @@ -197,7 +197,7 @@ bool gradual_tick_auto(uint8_t gt) { PWM_DATATYPE brightness = PWM_GET(pwm1_levels, gt); PWM_DATATYPE top = PWM_GET(pwm_tops, gt); uint8_t blend = 255 * (uint16_t)gt / RAMP_SIZE; - if (cfg.channel_mode_args[cfg.channel_mode] & 0b01000000) + if (cfg.channel_mode_args[channel_mode] & 0b01000000) blend = 255 - blend; calc_2ch_blend(&ch1_pwm, &ch2_pwm, brightness, top, blend); diff --git a/hwdef-noctigon-m44.c b/hwdef-noctigon-m44.c index 3fc6abe..0c73005 100644 --- a/hwdef-noctigon-m44.c +++ b/hwdef-noctigon-m44.c @@ -128,7 +128,7 @@ void set_level_blend(uint8_t level) { PWM_DATATYPE ch1_pwm, ch2_pwm; PWM_DATATYPE brightness = PWM_GET(pwm1_levels, level); PWM_DATATYPE top = PWM_GET(pwm_tops, level); - uint8_t blend = cfg.channel_mode_args[cfg.channel_mode]; + uint8_t blend = cfg.channel_mode_args[channel_mode]; calc_2ch_blend(&ch1_pwm, &ch2_pwm, brightness, top, blend); @@ -148,7 +148,7 @@ void set_level_auto(uint8_t level) { PWM_DATATYPE brightness = PWM_GET(pwm1_levels, level); PWM_DATATYPE top = PWM_GET(pwm_tops, level); uint8_t blend = 255 * (uint16_t)level / RAMP_SIZE; - if (cfg.channel_mode_args[cfg.channel_mode] & 0b01000000) + if (cfg.channel_mode_args[channel_mode] & 0b01000000) blend = 255 - blend; calc_2ch_blend(&ch1_pwm, &ch2_pwm, brightness, top, blend); @@ -189,7 +189,7 @@ bool gradual_tick_blend(uint8_t gt) { PWM_DATATYPE ch1_pwm, ch2_pwm; PWM_DATATYPE brightness = PWM_GET(pwm1_levels, gt); PWM_DATATYPE top = PWM_GET(pwm_tops, gt); - uint8_t blend = cfg.channel_mode_args[cfg.channel_mode]; + uint8_t blend = cfg.channel_mode_args[channel_mode]; calc_2ch_blend(&ch1_pwm, &ch2_pwm, brightness, top, blend); @@ -201,7 +201,7 @@ bool gradual_tick_auto(uint8_t gt) { PWM_DATATYPE brightness = PWM_GET(pwm1_levels, gt); PWM_DATATYPE top = PWM_GET(pwm_tops, gt); uint8_t blend = 255 * (uint16_t)gt / RAMP_SIZE; - if (cfg.channel_mode_args[cfg.channel_mode] & 0b01000000) + if (cfg.channel_mode_args[channel_mode] & 0b01000000) blend = 255 - blend; calc_2ch_blend(&ch1_pwm, &ch2_pwm, brightness, top, blend); diff --git a/hwdef-sofirn-lt1s-pro.c b/hwdef-sofirn-lt1s-pro.c index 6fe0fef..1359c29 100644 --- a/hwdef-sofirn-lt1s-pro.c +++ b/hwdef-sofirn-lt1s-pro.c @@ -107,7 +107,7 @@ void set_level_white_blend(uint8_t level) { PWM_DATATYPE warm_PWM, cool_PWM; PWM_DATATYPE brightness = PWM_GET(pwm1_levels, level); PWM_DATATYPE top = PWM_GET(pwm_tops, level); - uint8_t blend = cfg.channel_mode_args[cfg.channel_mode]; + uint8_t blend = cfg.channel_mode_args[channel_mode]; calc_2ch_blend(&warm_PWM, &cool_PWM, brightness, top, blend); @@ -172,9 +172,9 @@ void set_level_auto_3ch_blend(uint8_t level) { // "white + red" channel mode void set_level_red_white_blend(uint8_t level) { // set the warm+cool white LEDs first - cfg.channel_mode = CM_WHITE; + channel_mode = CM_WHITE; set_level_white_blend(level); - cfg.channel_mode = CM_WHITE_RED; + channel_mode = CM_WHITE_RED; if (level == 0) { RED_PWM_LVL = 0; @@ -188,7 +188,7 @@ void set_level_red_white_blend(uint8_t level) { // set the red LED as a ratio of the white output level // 0 = no red // 255 = red at 100% of white channel PWM - uint8_t ratio = cfg.channel_mode_args[cfg.channel_mode]; + uint8_t ratio = cfg.channel_mode_args[channel_mode]; RED_PWM_LVL = (((PWM_DATATYPE2)ratio * (PWM_DATATYPE2)vpwm) + 127) / 255; if (! actual_level) PWM_CNT = 0; // reset phase @@ -223,7 +223,7 @@ bool gradual_tick_white_blend(uint8_t gt) { PWM_DATATYPE warm_PWM, cool_PWM; PWM_DATATYPE brightness = PWM_GET(pwm1_levels, gt); PWM_DATATYPE top = PWM_GET(pwm_tops, gt); - uint8_t blend = cfg.channel_mode_args[cfg.channel_mode]; + uint8_t blend = cfg.channel_mode_args[channel_mode]; calc_2ch_blend(&warm_PWM, &cool_PWM, brightness, top, blend); @@ -259,7 +259,7 @@ bool gradual_tick_red_white_blend(uint8_t gt) { PWM_DATATYPE brightness = PWM_GET(pwm1_levels, gt); PWM_DATATYPE top = PWM_GET(pwm_tops, gt); uint8_t blend = cfg.channel_mode_args[CM_WHITE]; - uint8_t ratio = cfg.channel_mode_args[cfg.channel_mode]; + uint8_t ratio = cfg.channel_mode_args[channel_mode]; red = (((PWM_DATATYPE2)ratio * (PWM_DATATYPE2)brightness) + 127) / 255; calc_2ch_blend(&warm, &cool, brightness, top, blend); |
