From a9bf98b719a672c3b66266862c6f1071b47e2463 Mon Sep 17 00:00:00 2001 From: ole00 Date: Tue, 19 Mar 2024 20:46:34 +0000 Subject: [PATCH] Sketch: reduced duration on VPP ramp-up The VPP ramp-up was too long after the change of the calibration scale in recent commits. --- aftb_vpp.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/aftb_vpp.h b/aftb_vpp.h index 3c265ef..1f7681d 100644 --- a/aftb_vpp.h +++ b/aftb_vpp.h @@ -122,7 +122,6 @@ static void varVppSetVppIndex(uint8_t value) { static void varVppSet(uint8_t value) { uint8_t v; int8_t inc; - int8_t incMin; if (value == VPP_5V0 || value >= MAX_WIPER) { varVppSetVppIndex(0); return; @@ -134,19 +133,14 @@ static void varVppSet(uint8_t value) { Serial.println(vppWiper[value]); #endif //ramp up to prevent massive voltage overshoots - v = vppWiper[value] / 2; - v -= 2; - inc = 16; - incMin = 2; - if (value > VPP_13V0) { - incMin = 1; - } + v = vppWiper[value] / 3; + inc = v >> 2; while (v < vppWiper[value]) { varVppSetVppIndex(v); - v+= inc + (inc / 2); - inc -= inc / 2; - if (inc < incMin) { - inc = incMin; + v+= (inc << 1); + inc -= (inc >> 1); + if (inc < 2) { + inc = 2; } } varVppSetVppIndex(vppWiper[value]);