From 255133f7a652796e4386f469c90f6d71b5755088 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 29 Nov 2019 15:01:34 -0700 Subject: adjusted BLF Lantern (Sofirn LT1) tint ramping power correction factor to match production units (also made the factor configurable per build target) --- spaghetti-monster/fsm-ramping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'spaghetti-monster/fsm-ramping.c') diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c index 37c8073..8515885 100644 --- a/spaghetti-monster/fsm-ramping.c +++ b/spaghetti-monster/fsm-ramping.c @@ -72,6 +72,9 @@ void set_level(uint8_t level) { level --; #ifdef USE_TINT_RAMPING + #ifndef TINT_RAMPING_CORRECTION + #define TINT_RAMPING_CORRECTION 26 // 140% brightness at middle tint + #endif // calculate actual PWM levels based on a single-channel ramp // and a global tint value uint8_t brightness = pgm_read_byte(pwm1_levels + level); @@ -96,7 +99,7 @@ void set_level(uint8_t level) { // correction is only necessary when PWM is fast if (level > HALFSPEED_LEVEL) { base_PWM = brightness - + ((((uint16_t)brightness) * 26 / 64) * triangle_wave(mytint) / 255); + + ((((uint16_t)brightness) * TINT_RAMPING_CORRECTION / 64) * triangle_wave(mytint) / 255); } cool_PWM = (((uint16_t)mytint * (uint16_t)base_PWM) + 127) / 255; -- cgit v1.2.3