diff options
| author | Selene ToyKeeper | 2023-09-17 04:37:25 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2023-09-17 04:37:25 -0600 |
| commit | d34d0e7acb1f1e49d21af7cf1c9e08161ce95dd4 (patch) | |
| tree | f2bcb36951f2c83064c17ff58aca4c5c59eed112 /hwdef-sofirn-lt1s-pro.c | |
| parent | fixed bug: smooth steps could sometimes turn off entirely (diff) | |
| download | anduril-d34d0e7acb1f1e49d21af7cf1c9e08161ce95dd4.tar.gz anduril-d34d0e7acb1f1e49d21af7cf1c9e08161ce95dd4.tar.bz2 anduril-d34d0e7acb1f1e49d21af7cf1c9e08161ce95dd4.zip | |
fixed builds which weren't using set_level_zero() yet...
- emisar-d4
- emisar-d4v2
- emisar-d4v2-nofet
- emisar-d4sv2
- emisar-2ch
- emisar-2ch-fet
- noctigon-dm11-boost
- noctigon-k1
- noctigon-kr4
- noctigon-kr4-nofet
- sofirn-lt1s-pro
... and removed old build targets for d4sv2-tintramp, because it was
replaced by emisar-2ch a while ago.
Diffstat (limited to 'hwdef-sofirn-lt1s-pro.c')
| -rw-r--r-- | hwdef-sofirn-lt1s-pro.c | 62 |
1 files changed, 15 insertions, 47 deletions
diff --git a/hwdef-sofirn-lt1s-pro.c b/hwdef-sofirn-lt1s-pro.c index 1359c29..90c2c07 100644 --- a/hwdef-sofirn-lt1s-pro.c +++ b/hwdef-sofirn-lt1s-pro.c @@ -4,6 +4,8 @@ #pragma once +void set_level_zero(); + void set_level_red(uint8_t level); void set_level_white_blend(uint8_t level); void set_level_auto_2ch_blend(uint8_t level); @@ -76,34 +78,26 @@ void calc_auto_3ch_blend( } +void set_level_zero() { + WARM_PWM_LVL = 0; + COOL_PWM_LVL = 0; + RED_PWM_LVL = 0; + PWM_CNT = 0; // reset phase +} + // single set of LEDs with 1 power channel and dynamic PWM void set_level_red(uint8_t level) { - if (level == 0) { - RED_PWM_LVL = 0; - PWM_CNT = 0; // reset phase - } else { - level --; // PWM array index = level - 1 - RED_PWM_LVL = PWM_GET(pwm1_levels, level); - // pulse frequency modulation, a.k.a. dynamic PWM - PWM_TOP = PWM_GET(pwm_tops, level); - // force reset phase when turning on from zero - // (because otherwise the initial response is inconsistent) - if (! actual_level) PWM_CNT = 0; - } + RED_PWM_LVL = PWM_GET(pwm1_levels, level); + // pulse frequency modulation, a.k.a. dynamic PWM + PWM_TOP = PWM_GET(pwm_tops, level); + // force reset phase when turning on from zero + // (because otherwise the initial response is inconsistent) + if (! actual_level) PWM_CNT = 0; } // warm + cool blend w/ dynamic PWM void set_level_white_blend(uint8_t level) { - if (level == 0) { - WARM_PWM_LVL = 0; - COOL_PWM_LVL = 0; - PWM_CNT = 0; // reset phase - return; - } - - level --; // PWM array index = level - 1 - PWM_DATATYPE warm_PWM, cool_PWM; PWM_DATATYPE brightness = PWM_GET(pwm1_levels, level); PWM_DATATYPE top = PWM_GET(pwm_tops, level); @@ -120,15 +114,6 @@ void set_level_white_blend(uint8_t level) { // same as white blend, but tint is calculated from the ramp level void set_level_auto_2ch_blend(uint8_t level) { - if (level == 0) { - WARM_PWM_LVL = 0; - COOL_PWM_LVL = 0; - PWM_CNT = 0; // reset phase - return; - } - - level --; // PWM array index = level - 1 - PWM_DATATYPE warm_PWM, cool_PWM; PWM_DATATYPE brightness = PWM_GET(pwm1_levels, level); PWM_DATATYPE top = PWM_GET(pwm_tops, level); @@ -145,16 +130,6 @@ void set_level_auto_2ch_blend(uint8_t level) { // "auto tint" channel mode with dynamic PWM void set_level_auto_3ch_blend(uint8_t level) { - if (level == 0) { - WARM_PWM_LVL = 0; - COOL_PWM_LVL = 0; - RED_PWM_LVL = 0; - PWM_CNT = 0; // reset phase - return; - } - - level --; // PWM array index = level - 1 - PWM_DATATYPE a, b, c; calc_auto_3ch_blend(&a, &b, &c, level); @@ -176,13 +151,6 @@ void set_level_red_white_blend(uint8_t level) { set_level_white_blend(level); channel_mode = CM_WHITE_RED; - if (level == 0) { - RED_PWM_LVL = 0; - PWM_CNT = 0; // reset phase - return; - } - - level --; // PWM array index = level - 1 PWM_DATATYPE vpwm = PWM_GET(pwm1_levels, level); // set the red LED as a ratio of the white output level |
