Skip to content

Commit

Permalink
#47
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Aug 27, 2020
1 parent 01bde48 commit 373e6f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/eez/modules/psu/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ float Channel::getSwOvpProtectionLevel() {

bool Channel::checkSwOvpCondition() {
float uProtectionLevel = getSwOvpProtectionLevel();
return channel_dispatcher::getUMonLast(*this) + 0.5 > uProtectionLevel || (flags.rprogEnabled && channel_dispatcher::getUMonDacLast(*this) > uProtectionLevel);
return channel_dispatcher::getUMonLast(*this) > uProtectionLevel || (flags.rprogEnabled && channel_dispatcher::getUMonDacLast(*this) > uProtectionLevel);
}

void Channel::protectionCheck(ProtectionValue &cpv) {
Expand Down
15 changes: 12 additions & 3 deletions src/eez/modules/psu/list_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,12 @@ void tick(uint32_t tick_usec) {

active = true;

uint32_t tickCount = millis();
if (g_execution[i].currentTotalDwellTime <= CONF_COUNTER_THRESHOLD_IN_SECONDS) {
tickCount *= 1000;
uint32_t tickCount;
bool tickCountInMillis = g_execution[i].currentTotalDwellTime > CONF_COUNTER_THRESHOLD_IN_SECONDS;
if (tickCountInMillis) {
tickCount = millis();
} else {
tickCount = millis() * 1000;
}

if (io_pins::isInhibited()) {
Expand Down Expand Up @@ -638,9 +641,15 @@ 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);
if (!tickCountInMillis) {
tickCount /= 1000;
}
} else {
// ... else count in microseconds
g_execution[i].currentRemainingDwellTime = (uint32_t)round(g_execution[i].currentTotalDwellTime * 1000000L);
if (tickCountInMillis) {
tickCount *= 1000;
}
}
g_execution[i].nextPointTime = tickCount + g_execution[i].currentRemainingDwellTime;
}
Expand Down

0 comments on commit 373e6f4

Please sign in to comment.