aboutsummaryrefslogtreecommitdiff
path: root/hwdef-sofirn-lt1s-pro.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-08-24 17:08:01 -0600
committerSelene ToyKeeper2023-08-24 17:08:01 -0600
commit04a48e44b25d1c42dc26f837586a7503bb74b749 (patch)
treefb4b0536ef8d9b05fa606d5ab082a30addf08781 /hwdef-sofirn-lt1s-pro.c
parentfixed issue where tactical mode overrode strobe group memory (diff)
downloadanduril-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-sofirn-lt1s-pro.c12
1 files changed, 6 insertions, 6 deletions
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);