aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-ramping.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2019-12-17 18:35:30 -0700
committerSelene ToyKeeper2019-12-17 18:35:30 -0700
commit6fb89b14ecae8e629b9d8ad754f988804d273828 (patch)
treeb5cd330aed040cde14056c1788e72c41446976a4 /spaghetti-monster/fsm-ramping.c
parentchanged voltage colors to better match Noctigon K1 (diff)
parentfixed too-slow thermal response (was introduced in the irq-refactor branch) (diff)
downloadanduril-6fb89b14ecae8e629b9d8ad754f988804d273828.tar.gz
anduril-6fb89b14ecae8e629b9d8ad754f988804d273828.tar.bz2
anduril-6fb89b14ecae8e629b9d8ad754f988804d273828.zip
merged from fsm, mostly to get thermal regulation updates
Diffstat (limited to 'spaghetti-monster/fsm-ramping.c')
-rw-r--r--spaghetti-monster/fsm-ramping.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c
index ca93350..20500cc 100644
--- a/spaghetti-monster/fsm-ramping.c
+++ b/spaghetti-monster/fsm-ramping.c
@@ -81,6 +81,9 @@ void set_level(uint8_t level) {
#endif
#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 = PWM_GET(pwm1_levels, level);
@@ -105,7 +108,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;