Skip to content

Commit

Permalink
OVP limit +0.5 if remote programming
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Jan 14, 2020
1 parent a142e1c commit 5efc5ce
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 21 deletions.
25 changes: 12 additions & 13 deletions modular-psu-firmware.eez-project
Original file line number Diff line number Diff line change
Expand Up @@ -12746,7 +12746,7 @@
"width": 78,
"height": 32,
"focusStyle": {
"inheritFrom": "default"
"inheritFrom": "edit_value_active_M_center"
},
"displayOption": 0
},
Expand Down Expand Up @@ -12922,7 +12922,7 @@
"width": 78,
"height": 32,
"focusStyle": {
"inheritFrom": "default"
"inheritFrom": "edit_value_active_M_center"
},
"displayOption": 0
},
Expand Down Expand Up @@ -12950,7 +12950,7 @@
"width": 78,
"height": 32,
"focusStyle": {
"inheritFrom": "default"
"inheritFrom": "edit_value_active_M_center"
},
"displayOption": 0
}
Expand Down Expand Up @@ -12990,7 +12990,7 @@
"width": 78,
"height": 32,
"focusStyle": {
"inheritFrom": "default"
"inheritFrom": "edit_value_active_M_center"
},
"displayOption": 0
},
Expand Down Expand Up @@ -13018,7 +13018,7 @@
"width": 78,
"height": 32,
"focusStyle": {
"inheritFrom": "default"
"inheritFrom": "edit_value_active_M_center"
},
"displayOption": 0
}
Expand Down Expand Up @@ -13828,7 +13828,7 @@
"width": 74,
"height": 32,
"focusStyle": {
"inheritFrom": "default"
"inheritFrom": "edit_value_active_M_center"
},
"displayOption": 0
},
Expand Down Expand Up @@ -13972,7 +13972,7 @@
"width": 74,
"height": 32,
"focusStyle": {
"inheritFrom": "default"
"inheritFrom": "edit_value_active_M_center"
},
"displayOption": 0
}
Expand Down Expand Up @@ -14487,7 +14487,7 @@
"width": 95,
"height": 32,
"focusStyle": {
"inheritFrom": "default"
"inheritFrom": "edit_value_active_M_center"
},
"displayOption": 0
},
Expand Down Expand Up @@ -14566,7 +14566,7 @@
"width": 95,
"height": 32,
"focusStyle": {
"inheritFrom": "default"
"inheritFrom": "edit_value_active_M_center"
},
"displayOption": 0
},
Expand Down Expand Up @@ -14594,7 +14594,7 @@
"width": 78,
"height": 32,
"focusStyle": {
"inheritFrom": "default"
"inheritFrom": "edit_value_active_M_center"
},
"displayOption": 0
}
Expand Down Expand Up @@ -15027,7 +15027,7 @@
"width": 96,
"height": 32,
"focusStyle": {
"inheritFrom": "default"
"inheritFrom": "edit_value_active_M_center"
},
"displayOption": 0
},
Expand Down Expand Up @@ -15055,8 +15055,7 @@
"width": 96,
"height": 32,
"focusStyle": {
"inheritFrom": "default",
"padding": 0
"inheritFrom": "edit_value_active_M_center"
},
"displayOption": 0
},
Expand Down
13 changes: 7 additions & 6 deletions src/eez/modules/psu/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,13 +1007,14 @@ void Channel::doRemoteProgrammingEnable(bool enable) {
if (enable && !isOk()) {
return;
}

flags.rprogEnabled = enable;
if (enable) {
setVoltageLimit(u.max);
setVoltage(u.min);
prot_conf.u_level = u.max;
prot_conf.flags.u_state = 1;
}

channel_dispatcher::setVoltageLimit(*this, channel_dispatcher::getUMaxLimit(*this));
channel_dispatcher::setVoltage(*this, u.min);
channel_dispatcher::setOvpLevel(*this, channel_dispatcher::getUMaxOvpLevel(*this));
channel_dispatcher::setOvpState(*this, 1);

channelInterface->setRemoteProgramming(subchannelIndex, enable);
setOperBits(OPER_ISUM_RPROG_ON, enable);
}
Expand Down
7 changes: 7 additions & 0 deletions src/eez/modules/psu/channel_dispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,13 @@ float getUMax(const Channel &channel) {
return channel.u.max;
}

float getUMaxLimit(const Channel &channel) {
if (channel.flags.rprogEnabled) {
return getUMax(channel) + 0.5f;
}
return getUMax(channel);
}

float getUMaxOvpLevel(const Channel &channel) {
return getUMax(channel) + 0.5f;
}
Expand Down
1 change: 1 addition & 0 deletions src/eez/modules/psu/channel_dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ float getUMaxLimit(const Channel &channel);
float getUMin(const Channel &channel);
float getUDef(const Channel &channel);
float getUMax(const Channel &channel);
float getUMaxLimit(const Channel &channel);
float getUMaxOvpLevel(const Channel &channel);
float getUProtectionLevel(const Channel &channel);
void setVoltage(Channel &channel, float voltage);
Expand Down
2 changes: 1 addition & 1 deletion src/eez/modules/psu/gui/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2383,7 +2383,7 @@ void data_channel_protection_ovp_limit(data::DataOperationEnum operation, data::
} else if (operation == data::DATA_OPERATION_GET_MIN) {
value = MakeValue(channel_dispatcher::getUMin(channel), UNIT_VOLT);
} else if (operation == data::DATA_OPERATION_GET_MAX) {
value = MakeValue(channel_dispatcher::getUMax(channel), UNIT_VOLT);
value = MakeValue(channel_dispatcher::getUMaxLimit(channel), UNIT_VOLT);
} else if (operation == data::DATA_OPERATION_SET) {
channel_dispatcher::setVoltageLimit(channel, value.getFloat());
} else if (operation == data::DATA_OPERATION_GET_NAME) {
Expand Down
2 changes: 1 addition & 1 deletion src/eez/modules/psu/gui/page_ch_settings_protection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void ChSettingsOvpProtectionPage::pageAlloc() {

origLimit = limit = MakeValue(channel_dispatcher::getULimit(*g_channel), UNIT_VOLT);
minLimit = channel_dispatcher::getUMin(*g_channel);
maxLimit = channel_dispatcher::getUMax(*g_channel);
maxLimit = channel_dispatcher::getUMaxLimit(*g_channel);
defLimit = channel_dispatcher::getUMax(*g_channel);

origLevel = level = MakeValue(channel_dispatcher::getUProtectionLevel(*g_channel), UNIT_VOLT);
Expand Down

0 comments on commit 5efc5ce

Please sign in to comment.