File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -537,7 +537,7 @@ float Channel::getSwOvpProtectionLevel() {
537537
538538bool Channel::checkSwOvpCondition () {
539539 float uProtectionLevel = getSwOvpProtectionLevel ();
540- return channel_dispatcher::getUMonLast (*this ) + 0.5 > uProtectionLevel || (flags.rprogEnabled && channel_dispatcher::getUMonDacLast (*this ) > uProtectionLevel);
540+ return channel_dispatcher::getUMonLast (*this ) > uProtectionLevel || (flags.rprogEnabled && channel_dispatcher::getUMonDacLast (*this ) > uProtectionLevel);
541541}
542542
543543void Channel::protectionCheck (ProtectionValue &cpv) {
Original file line number Diff line number Diff line change @@ -591,9 +591,12 @@ void tick(uint32_t tick_usec) {
591591
592592 active = true ;
593593
594- uint32_t tickCount = millis ();
595- if (g_execution[i].currentTotalDwellTime <= CONF_COUNTER_THRESHOLD_IN_SECONDS) {
596- tickCount *= 1000 ;
594+ uint32_t tickCount;
595+ bool tickCountInMillis = g_execution[i].currentTotalDwellTime > CONF_COUNTER_THRESHOLD_IN_SECONDS;
596+ if (tickCountInMillis) {
597+ tickCount = millis ();
598+ } else {
599+ tickCount = millis () * 1000 ;
597600 }
598601
599602 if (io_pins::isInhibited ()) {
@@ -638,9 +641,15 @@ void tick(uint32_t tick_usec) {
638641 if (g_execution[i].currentTotalDwellTime > CONF_COUNTER_THRESHOLD_IN_SECONDS) {
639642 // ... then count in milliseconds
640643 g_execution[i].currentRemainingDwellTime = (uint32_t )round (g_execution[i].currentTotalDwellTime * 1000L );
644+ if (!tickCountInMillis) {
645+ tickCount /= 1000 ;
646+ }
641647 } else {
642648 // ... else count in microseconds
643649 g_execution[i].currentRemainingDwellTime = (uint32_t )round (g_execution[i].currentTotalDwellTime * 1000000L );
650+ if (tickCountInMillis) {
651+ tickCount *= 1000 ;
652+ }
644653 }
645654 g_execution[i].nextPointTime = tickCount + g_execution[i].currentRemainingDwellTime ;
646655 }
You can’t perform that action at this time.
0 commit comments