From 614785d1529e0c6fb1e99589011a9e2ca98133e4 Mon Sep 17 00:00:00 2001 From: Martin Vladic Date: Wed, 1 Jul 2020 10:52:27 +0200 Subject: [PATCH] #28 --- src/eez/modules/psu/list_program.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/eez/modules/psu/list_program.cpp b/src/eez/modules/psu/list_program.cpp index 6d48f0a1f..028e23584 100644 --- a/src/eez/modules/psu/list_program.cpp +++ b/src/eez/modules/psu/list_program.cpp @@ -591,11 +591,9 @@ void tick(uint32_t tick_usec) { active = true; - uint32_t tickCount; - if (g_execution[i].currentTotalDwellTime > CONF_COUNTER_THRESHOLD_IN_SECONDS) { - tickCount = millis(); - } else { - tickCount = tick_usec; + uint32_t tickCount = millis(); + if (g_execution[i].currentTotalDwellTime <= CONF_COUNTER_THRESHOLD_IN_SECONDS) { + tickCount *= 1000; } if (io_pins::isInhibited()) { @@ -640,12 +638,11 @@ void tick(uint32_t tick_usec) { if (g_execution[i].currentTotalDwellTime > CONF_COUNTER_THRESHOLD_IN_SECONDS) { // ... then count in milliseconds g_execution[i].currentRemainingDwellTime = (uint32_t)round(g_execution[i].currentTotalDwellTime * 1000L); - g_execution[i].nextPointTime = millis() + g_execution[i].currentRemainingDwellTime; } else { // ... else count in microseconds g_execution[i].currentRemainingDwellTime = (uint32_t)round(g_execution[i].currentTotalDwellTime * 1000000L); - g_execution[i].nextPointTime = tick_usec + g_execution[i].currentRemainingDwellTime; } + g_execution[i].nextPointTime = tickCount + g_execution[i].currentRemainingDwellTime; } }