Skip to content

Commit 16e53fb

Browse files
committed
1 parent df5c724 commit 16e53fb

28 files changed

+52963
-52201
lines changed

modular-psu-firmware.eez-project

+67-10
Original file line numberDiff line numberDiff line change
@@ -2308,6 +2308,11 @@
23082308
"name": "channel_has_firmware_update",
23092309
"type": "boolean",
23102310
"defaultValue": "1"
2311+
},
2312+
{
2313+
"name": "channel_calibration_value_type_is_selectable",
2314+
"type": "boolean",
2315+
"defaultValue": "1"
23112316
}
23122317
],
23132318
"actions": [
@@ -14855,17 +14860,43 @@
1485514860
"height": 224,
1485614861
"widgets": [
1485714862
{
14858-
"type": "Text",
14863+
"type": "Select",
1485914864
"style": {
14860-
"inheritFrom": "edit_value_active_M_center"
14865+
"inheritFrom": "default"
1486114866
},
14862-
"data": "channel_calibration_value_type",
14863-
"action": "select_channel_calibration_value_type",
14867+
"data": "channel_calibration_value_type_is_selectable",
1486414868
"left": 0,
1486514869
"top": 0,
1486614870
"width": 219,
1486714871
"height": 38,
14868-
"text": ""
14872+
"widgets": [
14873+
{
14874+
"type": "Text",
14875+
"style": {
14876+
"inheritFrom": "edit_value_M_centered"
14877+
},
14878+
"data": "channel_calibration_value_type",
14879+
"action": "",
14880+
"left": 0,
14881+
"top": 0,
14882+
"width": 219,
14883+
"height": 38,
14884+
"text": ""
14885+
},
14886+
{
14887+
"type": "Text",
14888+
"style": {
14889+
"inheritFrom": "edit_value_active_M_center"
14890+
},
14891+
"data": "channel_calibration_value_type",
14892+
"action": "select_channel_calibration_value_type",
14893+
"left": 0,
14894+
"top": 0,
14895+
"width": 219,
14896+
"height": 38,
14897+
"text": ""
14898+
}
14899+
]
1486914900
},
1487014901
{
1487114902
"type": "Rectangle",
@@ -15274,17 +15305,43 @@
1527415305
"height": 224,
1527515306
"widgets": [
1527615307
{
15277-
"type": "Text",
15308+
"type": "Select",
1527815309
"style": {
15279-
"inheritFrom": "edit_value_active_M_center"
15310+
"inheritFrom": "default"
1528015311
},
15281-
"data": "channel_calibration_value_type",
15282-
"action": "select_channel_calibration_value_type",
15312+
"data": "channel_calibration_value_type_is_selectable",
1528315313
"left": 0,
1528415314
"top": 0,
1528515315
"width": 219,
1528615316
"height": 38,
15287-
"text": ""
15317+
"widgets": [
15318+
{
15319+
"type": "Text",
15320+
"style": {
15321+
"inheritFrom": "edit_value_M_centered"
15322+
},
15323+
"data": "channel_calibration_value_type",
15324+
"action": "",
15325+
"left": 0,
15326+
"top": 0,
15327+
"width": 219,
15328+
"height": 38,
15329+
"text": ""
15330+
},
15331+
{
15332+
"type": "Text",
15333+
"style": {
15334+
"inheritFrom": "edit_value_active_M_center"
15335+
},
15336+
"data": "channel_calibration_value_type",
15337+
"action": "select_channel_calibration_value_type",
15338+
"left": 0,
15339+
"top": 0,
15340+
"width": 219,
15341+
"height": 38,
15342+
"text": ""
15343+
}
15344+
]
1528815345
},
1528915346
{
1529015347
"type": "Rectangle",

src/eez/action_impl.cpp

+13-18
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,13 @@ void action_ch_settings_calibration_start_calibration() {
410410
}
411411

412412
void action_ch_settings_calibration_toggle_enable() {
413-
Channel &channel = g_channel ? *g_channel : Channel::get(getFoundWidgetAtDown().cursor);
414-
channel.calibrationEnable(!channel.isCalibrationEnabled());
413+
if (g_channel) {
414+
g_channel->calibrationEnable(!g_channel->isCalibrationEnabled());
415+
} else {
416+
bool enable = !g_slots[hmi::g_selectedSlotIndex]->isVoltageCalibrationEnabled(hmi::g_selectedSubchannelIndex);
417+
g_slots[hmi::g_selectedSlotIndex]->enableVoltageCalibration(hmi::g_selectedSubchannelIndex, enable);
418+
g_slots[hmi::g_selectedSlotIndex]->enableCurrentCalibration(hmi::g_selectedSubchannelIndex, enable);
419+
}
415420
}
416421

417422
void action_ch_settings_calibration_view_points() {
@@ -423,31 +428,21 @@ void onSetChannelCalibrationValueType(uint16_t value) {
423428

424429
auto editPage = (ChSettingsCalibrationEditPage *)getPage(PAGE_ID_CH_SETTINGS_CALIBRATION_EDIT);
425430
if (editPage) {
426-
editPage->setCalibrationValueType((calibration::CalibrationValueType)value);
431+
editPage->setCalibrationValueType((CalibrationValueType)value);
427432
} else {
428433
auto viewPage = (ChSettingsCalibrationViewPage *)getPage(PAGE_ID_CH_SETTINGS_CALIBRATION_VIEW);
429434
if (viewPage) {
430-
viewPage->setCalibrationValueType((calibration::CalibrationValueType)value);
435+
viewPage->setCalibrationValueType((CalibrationValueType)value);
431436
}
432437
}
433438
}
434439

435440
void action_select_channel_calibration_value_type() {
436-
auto editPage = (ChSettingsCalibrationEditPage *)getPage(PAGE_ID_CH_SETTINGS_CALIBRATION_EDIT);
437-
if (editPage) {
438-
if (calibration::getCalibrationChannel().hasSupportForCurrentDualRange()) {
439-
pushSelectFromEnumPage(ENUM_DEFINITION_CALIBRATION_VALUE_TYPE_DUAL_RANGE, editPage->getCalibrationValueType(), nullptr, onSetChannelCalibrationValueType);
440-
} else {
441-
pushSelectFromEnumPage(ENUM_DEFINITION_CALIBRATION_VALUE_TYPE, editPage->getCalibrationValueType(), nullptr, onSetChannelCalibrationValueType);
442-
}
441+
if (calibration::hasSupportForCurrentDualRange()) {
442+
pushSelectFromEnumPage(ENUM_DEFINITION_CALIBRATION_VALUE_TYPE_DUAL_RANGE, calibration::getCalibrationValueType(), nullptr, onSetChannelCalibrationValueType);
443443
} else {
444-
auto viewPage = (ChSettingsCalibrationViewPage *)getPage(PAGE_ID_CH_SETTINGS_CALIBRATION_VIEW);
445-
if (g_channel->hasSupportForCurrentDualRange()) {
446-
pushSelectFromEnumPage(ENUM_DEFINITION_CALIBRATION_VALUE_TYPE_DUAL_RANGE, viewPage->getCalibrationValueType(), nullptr, onSetChannelCalibrationValueType);
447-
} else {
448-
pushSelectFromEnumPage(ENUM_DEFINITION_CALIBRATION_VALUE_TYPE, viewPage->getCalibrationValueType(), nullptr, onSetChannelCalibrationValueType);
449-
}
450-
}
444+
pushSelectFromEnumPage(ENUM_DEFINITION_CALIBRATION_VALUE_TYPE, calibration::getCalibrationValueType(), nullptr, onSetChannelCalibrationValueType);
445+
}
451446
}
452447

453448
void action_channel_calibration_point_previous() {

0 commit comments

Comments
 (0)