Sketch: reduced duration on VPP ramp-up

The VPP ramp-up was too long after the change of the calibration
scale in recent commits.
This commit is contained in:
ole00 2024-03-19 20:46:34 +00:00
parent dabfcf5aad
commit a9bf98b719

View File

@ -122,7 +122,6 @@ static void varVppSetVppIndex(uint8_t value) {
static void varVppSet(uint8_t value) { static void varVppSet(uint8_t value) {
uint8_t v; uint8_t v;
int8_t inc; int8_t inc;
int8_t incMin;
if (value == VPP_5V0 || value >= MAX_WIPER) { if (value == VPP_5V0 || value >= MAX_WIPER) {
varVppSetVppIndex(0); varVppSetVppIndex(0);
return; return;
@ -134,19 +133,14 @@ static void varVppSet(uint8_t value) {
Serial.println(vppWiper[value]); Serial.println(vppWiper[value]);
#endif #endif
//ramp up to prevent massive voltage overshoots //ramp up to prevent massive voltage overshoots
v = vppWiper[value] / 2; v = vppWiper[value] / 3;
v -= 2; inc = v >> 2;
inc = 16;
incMin = 2;
if (value > VPP_13V0) {
incMin = 1;
}
while (v < vppWiper[value]) { while (v < vppWiper[value]) {
varVppSetVppIndex(v); varVppSetVppIndex(v);
v+= inc + (inc / 2); v+= (inc << 1);
inc -= inc / 2; inc -= (inc >> 1);
if (inc < incMin) { if (inc < 2) {
inc = incMin; inc = 2;
} }
} }
varVppSetVppIndex(vppWiper[value]); varVppSetVppIndex(vppWiper[value]);