Skip to content

Commit 5efc5ce

Browse files
committed
OVP limit +0.5 if remote programming
1 parent a142e1c commit 5efc5ce

6 files changed

+29
-21
lines changed

modular-psu-firmware.eez-project

+12-13
Original file line numberDiff line numberDiff line change
@@ -12746,7 +12746,7 @@
1274612746
"width": 78,
1274712747
"height": 32,
1274812748
"focusStyle": {
12749-
"inheritFrom": "default"
12749+
"inheritFrom": "edit_value_active_M_center"
1275012750
},
1275112751
"displayOption": 0
1275212752
},
@@ -12922,7 +12922,7 @@
1292212922
"width": 78,
1292312923
"height": 32,
1292412924
"focusStyle": {
12925-
"inheritFrom": "default"
12925+
"inheritFrom": "edit_value_active_M_center"
1292612926
},
1292712927
"displayOption": 0
1292812928
},
@@ -12950,7 +12950,7 @@
1295012950
"width": 78,
1295112951
"height": 32,
1295212952
"focusStyle": {
12953-
"inheritFrom": "default"
12953+
"inheritFrom": "edit_value_active_M_center"
1295412954
},
1295512955
"displayOption": 0
1295612956
}
@@ -12990,7 +12990,7 @@
1299012990
"width": 78,
1299112991
"height": 32,
1299212992
"focusStyle": {
12993-
"inheritFrom": "default"
12993+
"inheritFrom": "edit_value_active_M_center"
1299412994
},
1299512995
"displayOption": 0
1299612996
},
@@ -13018,7 +13018,7 @@
1301813018
"width": 78,
1301913019
"height": 32,
1302013020
"focusStyle": {
13021-
"inheritFrom": "default"
13021+
"inheritFrom": "edit_value_active_M_center"
1302213022
},
1302313023
"displayOption": 0
1302413024
}
@@ -13828,7 +13828,7 @@
1382813828
"width": 74,
1382913829
"height": 32,
1383013830
"focusStyle": {
13831-
"inheritFrom": "default"
13831+
"inheritFrom": "edit_value_active_M_center"
1383213832
},
1383313833
"displayOption": 0
1383413834
},
@@ -13972,7 +13972,7 @@
1397213972
"width": 74,
1397313973
"height": 32,
1397413974
"focusStyle": {
13975-
"inheritFrom": "default"
13975+
"inheritFrom": "edit_value_active_M_center"
1397613976
},
1397713977
"displayOption": 0
1397813978
}
@@ -14487,7 +14487,7 @@
1448714487
"width": 95,
1448814488
"height": 32,
1448914489
"focusStyle": {
14490-
"inheritFrom": "default"
14490+
"inheritFrom": "edit_value_active_M_center"
1449114491
},
1449214492
"displayOption": 0
1449314493
},
@@ -14566,7 +14566,7 @@
1456614566
"width": 95,
1456714567
"height": 32,
1456814568
"focusStyle": {
14569-
"inheritFrom": "default"
14569+
"inheritFrom": "edit_value_active_M_center"
1457014570
},
1457114571
"displayOption": 0
1457214572
},
@@ -14594,7 +14594,7 @@
1459414594
"width": 78,
1459514595
"height": 32,
1459614596
"focusStyle": {
14597-
"inheritFrom": "default"
14597+
"inheritFrom": "edit_value_active_M_center"
1459814598
},
1459914599
"displayOption": 0
1460014600
}
@@ -15027,7 +15027,7 @@
1502715027
"width": 96,
1502815028
"height": 32,
1502915029
"focusStyle": {
15030-
"inheritFrom": "default"
15030+
"inheritFrom": "edit_value_active_M_center"
1503115031
},
1503215032
"displayOption": 0
1503315033
},
@@ -15055,8 +15055,7 @@
1505515055
"width": 96,
1505615056
"height": 32,
1505715057
"focusStyle": {
15058-
"inheritFrom": "default",
15059-
"padding": 0
15058+
"inheritFrom": "edit_value_active_M_center"
1506015059
},
1506115060
"displayOption": 0
1506215061
},

src/eez/modules/psu/channel.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -1007,13 +1007,14 @@ void Channel::doRemoteProgrammingEnable(bool enable) {
10071007
if (enable && !isOk()) {
10081008
return;
10091009
}
1010+
10101011
flags.rprogEnabled = enable;
1011-
if (enable) {
1012-
setVoltageLimit(u.max);
1013-
setVoltage(u.min);
1014-
prot_conf.u_level = u.max;
1015-
prot_conf.flags.u_state = 1;
1016-
}
1012+
1013+
channel_dispatcher::setVoltageLimit(*this, channel_dispatcher::getUMaxLimit(*this));
1014+
channel_dispatcher::setVoltage(*this, u.min);
1015+
channel_dispatcher::setOvpLevel(*this, channel_dispatcher::getUMaxOvpLevel(*this));
1016+
channel_dispatcher::setOvpState(*this, 1);
1017+
10171018
channelInterface->setRemoteProgramming(subchannelIndex, enable);
10181019
setOperBits(OPER_ISUM_RPROG_ON, enable);
10191020
}

src/eez/modules/psu/channel_dispatcher.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,13 @@ float getUMax(const Channel &channel) {
531531
return channel.u.max;
532532
}
533533

534+
float getUMaxLimit(const Channel &channel) {
535+
if (channel.flags.rprogEnabled) {
536+
return getUMax(channel) + 0.5f;
537+
}
538+
return getUMax(channel);
539+
}
540+
534541
float getUMaxOvpLevel(const Channel &channel) {
535542
return getUMax(channel) + 0.5f;
536543
}

src/eez/modules/psu/channel_dispatcher.h

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ float getUMaxLimit(const Channel &channel);
6060
float getUMin(const Channel &channel);
6161
float getUDef(const Channel &channel);
6262
float getUMax(const Channel &channel);
63+
float getUMaxLimit(const Channel &channel);
6364
float getUMaxOvpLevel(const Channel &channel);
6465
float getUProtectionLevel(const Channel &channel);
6566
void setVoltage(Channel &channel, float voltage);

src/eez/modules/psu/gui/data.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,7 @@ void data_channel_protection_ovp_limit(data::DataOperationEnum operation, data::
23832383
} else if (operation == data::DATA_OPERATION_GET_MIN) {
23842384
value = MakeValue(channel_dispatcher::getUMin(channel), UNIT_VOLT);
23852385
} else if (operation == data::DATA_OPERATION_GET_MAX) {
2386-
value = MakeValue(channel_dispatcher::getUMax(channel), UNIT_VOLT);
2386+
value = MakeValue(channel_dispatcher::getUMaxLimit(channel), UNIT_VOLT);
23872387
} else if (operation == data::DATA_OPERATION_SET) {
23882388
channel_dispatcher::setVoltageLimit(channel, value.getFloat());
23892389
} else if (operation == data::DATA_OPERATION_GET_NAME) {

src/eez/modules/psu/gui/page_ch_settings_protection.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void ChSettingsOvpProtectionPage::pageAlloc() {
165165

166166
origLimit = limit = MakeValue(channel_dispatcher::getULimit(*g_channel), UNIT_VOLT);
167167
minLimit = channel_dispatcher::getUMin(*g_channel);
168-
maxLimit = channel_dispatcher::getUMax(*g_channel);
168+
maxLimit = channel_dispatcher::getUMaxLimit(*g_channel);
169169
defLimit = channel_dispatcher::getUMax(*g_channel);
170170

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

0 commit comments

Comments
 (0)