aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2021-09-10 00:48:01 -0600
committerSelene ToyKeeper2021-09-10 00:48:01 -0600
commitb8b6214b7e9c3f2bb86f7379995fb64c73736d11 (patch)
tree4f48df3de32f9ec90cf12decb4ffa46f6d9c4e02
parentadded D4Sv2-tintramp-FET build, which uses a FET on one set of LEDs for turbo... (diff)
downloadanduril-b8b6214b7e9c3f2bb86f7379995fb64c73736d11.tar.gz
anduril-b8b6214b7e9c3f2bb86f7379995fb64c73736d11.tar.bz2
anduril-b8b6214b7e9c3f2bb86f7379995fb64c73736d11.zip
fixed ancient bug which caused a weird up-spike in thermal regulation during initial turbo drop,
on 3-channel drivers like FW3A and ROT66 (as shown here: http://toykeeper.net/torches/fw3a/therm-2019-05-22.1.png ) What happened was... the FET would start to drop, but gradual adjustments noticed that the Nx7135 channel needed to go from 0 to 255, so it would then slowly ramp that up, and then afterward, the FET drop could finally continue... because the code didn't jump straight from 0 to 255 like it was supposed to. Simple, easy fix: Make channel 2 go up immediately just like channel 1 does. This makes the thermal response several seconds faster than it was before, so it doesn't get as hot, and is less likely to overshoot and bounce later.
-rw-r--r--spaghetti-monster/fsm-ramping.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c
index 50907ec..88fb490 100644
--- a/spaghetti-monster/fsm-ramping.c
+++ b/spaghetti-monster/fsm-ramping.c
@@ -221,14 +221,23 @@ void gradual_tick() {
#if PWM_CHANNELS >= 1
target = PWM_GET(pwm1_levels, gt);
- if ((gt < actual_level) // special case for FET-only turbo
- && (PWM1_LVL == 0) // (bypass adjustment period for first step)
- && (target == PWM_TOP)) PWM1_LVL = PWM_TOP;
- else if (PWM1_LVL < target) PWM1_LVL ++;
+ #if PWM_CHANNELS > 1
+ if ((gt < actual_level) // special case for FET-only turbo
+ && (PWM1_LVL == 0) // (bypass adjustment period for first step)
+ && (target == PWM_TOP)) PWM1_LVL = PWM_TOP;
+ else
+ #endif
+ if (PWM1_LVL < target) PWM1_LVL ++;
else if (PWM1_LVL > target) PWM1_LVL --;
#endif
#if PWM_CHANNELS >= 2
target = PWM_GET(pwm2_levels, gt);
+ #if PWM_CHANNELS > 2
+ if ((gt < actual_level) // special case for FET-only turbo
+ && (PWM2_LVL == 0) // (bypass adjustment period for first step)
+ && (target == PWM_TOP)) PWM2_LVL = PWM_TOP;
+ else
+ #endif
if (PWM2_LVL < target) PWM2_LVL ++;
else if (PWM2_LVL > target) PWM2_LVL --;
#endif