diff --git a/modular-psu-firmware.eez-project b/modular-psu-firmware.eez-project index 2ed1b31e1..0c2256b1e 100644 --- a/modular-psu-firmware.eez-project +++ b/modular-psu-firmware.eez-project @@ -1535,9 +1535,14 @@ "type": "string", "defaultValue": "#1" }, + { + "name": "channel.shortTitleWithoutTrackingIcon", + "type": "string", + "defaultValue": "#1" + }, { "name": "channel.longTitle", - "defaultValue": "DCP405 #1: 40V/5a, r3B1" + "defaultValue": "\\u00A2 DCP405 #1: 40V/5a, r3B1" }, { "name": "scripts", @@ -1790,6 +1795,12 @@ "name": "channel.coupling.enableTrackingMode", "type": "boolean", "defaultValue": "1" + }, + { + "name": "channel.activeCoupledLed", + "type": "enum", + "enumItems": "[\"Off\", \"Active\", \"Coupled\"]", + "defaultValue": "1" } ], "actions": [ @@ -15448,7 +15459,7 @@ "data": "channel.longTitle", "left": 132, "top": 0, - "width": 252, + "width": 332, "height": 32, "focusStyle": { "inheritFrom": "default", @@ -24987,7 +24998,7 @@ "activeStyle": { "inheritFrom": "default" }, - "data": "channel.shortTitle", + "data": "channel.shortTitleWithoutTrackingIcon", "left": 26, "top": 0, "width": 34, @@ -25051,7 +25062,7 @@ "activeStyle": { "inheritFrom": "default" }, - "data": "channel.shortTitle", + "data": "channel.shortTitleWithoutTrackingIcon", "left": 26, "top": 0, "width": 34, @@ -25134,7 +25145,7 @@ "activeStyle": { "inheritFrom": "default_active" }, - "data": "channel.shortTitle", + "data": "channel.shortTitleWithoutTrackingIcon", "left": 26, "top": 0, "width": 29, @@ -25186,7 +25197,7 @@ "activeStyle": { "inheritFrom": "default" }, - "data": "channel.shortTitle", + "data": "channel.shortTitleWithoutTrackingIcon", "left": 26, "top": 0, "width": 34, @@ -44901,7 +44912,7 @@ "style": { "inheritFrom": "inst_minimized", "font": "Oswald14", - "alignHorizontal": "center", + "alignHorizontal": "left", "color": "status_warning", "padding": "0 5" }, @@ -48371,7 +48382,7 @@ "inheritFrom": "default", "padding": 0 }, - "data": "channel.outputState", + "data": "channel.activeCoupledLed", "left": 31, "top": 328, "width": 20, @@ -48398,123 +48409,44 @@ "height": 20 }, { - "type": "Select", + "type": "Rectangle", "style": { "inheritFrom": "default", + "color": "#00ff00", "backgroundColor": "#ffffff", + "borderSize": 2, + "borderRadius": 8, + "borderColor": "#404040", "padding": 0 }, "activeStyle": { "inheritFrom": "default", "padding": 0 }, - "data": "channel.coupling.mode", "left": 0, "top": 0, "width": 20, - "height": 20, - "widgets": [ - { - "type": "Rectangle", - "style": { - "inheritFrom": "default", - "color": "#00ff00", - "backgroundColor": "#ffffff", - "borderSize": 2, - "borderRadius": 8, - "borderColor": "#404040", - "padding": 0 - }, - "activeStyle": { - "inheritFrom": "default", - "padding": 0 - }, - "left": 0, - "top": 0, - "width": 20, - "height": 20 - }, - { - "type": "Rectangle", - "style": { - "inheritFrom": "default", - "color": "#ff040b", - "backgroundColor": "#ffffff", - "borderSize": 2, - "borderRadius": 8, - "borderColor": "#404040", - "padding": 0 - }, - "activeStyle": { - "inheritFrom": "default", - "padding": 0 - }, - "left": 0, - "top": 0, - "width": 20, - "height": 20 - }, - { - "type": "Rectangle", - "style": { - "inheritFrom": "default", - "color": "#ff040b", - "backgroundColor": "#ffffff", - "borderSize": 2, - "borderRadius": 8, - "borderColor": "#404040", - "padding": 0 - }, - "activeStyle": { - "inheritFrom": "default", - "padding": 0 - }, - "left": 0, - "top": 0, - "width": 20, - "height": 20 - }, - { - "type": "Rectangle", - "style": { - "inheritFrom": "default", - "color": "#ff040b", - "backgroundColor": "#ffffff", - "borderSize": 2, - "borderRadius": 8, - "borderColor": "#404040", - "padding": 0 - }, - "activeStyle": { - "inheritFrom": "default", - "padding": 0 - }, - "left": 0, - "top": 0, - "width": 20, - "height": 20 - }, - { - "type": "Rectangle", - "style": { - "inheritFrom": "default", - "color": "#ff040b", - "backgroundColor": "#ffffff", - "borderSize": 2, - "borderRadius": 8, - "borderColor": "#404040", - "padding": 0 - }, - "activeStyle": { - "inheritFrom": "default", - "padding": 0 - }, - "left": 0, - "top": 0, - "width": 20, - "height": 20 - } - ] + "height": 20 + }, + { + "type": "Rectangle", + "style": { + "inheritFrom": "default", + "color": "#ff040b", + "backgroundColor": "#ffffff", + "borderSize": 2, + "borderRadius": 8, + "borderColor": "#404040", + "padding": 0 + }, + "activeStyle": { + "inheritFrom": "default", + "padding": 0 + }, + "left": 0, + "top": 0, + "width": 20, + "height": 20 } ] } @@ -75401,6 +75333,386 @@ "size": 14, "encoding": 62623 } + }, + { + "encoding": 162, + "x": 0, + "y": 0, + "width": 19, + "height": 19, + "dx": 19, + "glyphBitmap": { + "height": 19, + "pixelArray": [ + 0, + 0, + 0, + 38, + 199, + 244, + 155, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 40, + 231, + 255, + 255, + 255, + 182, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 40, + 231, + 255, + 193, + 115, + 231, + 255, + 183, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 40, + 232, + 255, + 181, + 8, + 0, + 39, + 230, + 255, + 184, + 7, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 200, + 255, + 192, + 8, + 0, + 0, + 0, + 39, + 230, + 255, + 118, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 248, + 255, + 110, + 0, + 0, + 0, + 1, + 3, + 39, + 230, + 161, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 161, + 255, + 227, + 35, + 0, + 1, + 186, + 239, + 63, + 39, + 70, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 187, + 255, + 226, + 35, + 5, + 242, + 255, + 245, + 62, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 187, + 255, + 226, + 35, + 70, + 247, + 255, + 244, + 61, + 0, + 65, + 157, + 115, + 7, + 0, + 0, + 0, + 0, + 0, + 10, + 187, + 255, + 226, + 35, + 70, + 247, + 255, + 244, + 60, + 39, + 230, + 255, + 181, + 8, + 0, + 0, + 0, + 0, + 0, + 8, + 124, + 167, + 70, + 0, + 70, + 247, + 255, + 243, + 59, + 38, + 229, + 255, + 181, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 70, + 247, + 255, + 239, + 6, + 37, + 229, + 255, + 181, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 66, + 34, + 70, + 245, + 205, + 2, + 0, + 37, + 229, + 255, + 156, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 163, + 226, + 34, + 10, + 3, + 0, + 0, + 0, + 111, + 255, + 247, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 122, + 255, + 225, + 33, + 0, + 0, + 0, + 5, + 185, + 255, + 204, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 187, + 255, + 225, + 33, + 0, + 5, + 172, + 255, + 234, + 42, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 187, + 255, + 226, + 107, + 184, + 255, + 234, + 43, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 187, + 255, + 255, + 255, + 234, + 43, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 161, + 248, + 203, + 42, + 0, + 0, + 0 + ], + "width": 19 + }, + "source": { + "filePath": "fonts\\webhostinghub-glyphs.ttf", + "size": 14, + "encoding": 61474 + } } ] }, diff --git a/src/eez/apps/psu/gui/data.cpp b/src/eez/apps/psu/gui/data.cpp index 3061715ad..572e43e4d 100644 --- a/src/eez/apps/psu/gui/data.cpp +++ b/src/eez/apps/psu/gui/data.cpp @@ -592,31 +592,59 @@ void FLOAT_LIST_value_to_text(const Value &value, char *text, int count) { } bool compare_CHANNEL_TITLE_value(const Value &a, const Value &b) { - return a.getInt() == b.getInt(); + Channel &aChannel = Channel::get(a.getInt()); + Channel &bChannel = Channel::get(b.getInt()); + return aChannel.channelIndex == bChannel.channelIndex && aChannel.flags.trackingEnabled == bChannel.flags.trackingEnabled; } void CHANNEL_TITLE_value_to_text(const Value &value, char *text, int count) { Channel &channel = Channel::get(value.getInt()); - snprintf(text, count - 1, "%s #%d", channel.getBoardName(), channel.channelIndex + 1); + if (channel.flags.trackingEnabled) { + snprintf(text, count - 1, "\xA2 #%d", channel.channelIndex + 1); + } else { + snprintf(text, count - 1, "%s #%d", channel.getBoardName(), channel.channelIndex + 1); + } } bool compare_CHANNEL_SHORT_TITLE_value(const Value &a, const Value &b) { - return a.getInt() == b.getInt(); + Channel &aChannel = Channel::get(a.getInt()); + Channel &bChannel = Channel::get(b.getInt()); + return aChannel.channelIndex == bChannel.channelIndex && aChannel.flags.trackingEnabled == bChannel.flags.trackingEnabled; } void CHANNEL_SHORT_TITLE_value_to_text(const Value &value, char *text, int count) { + Channel &channel = Channel::get(value.getInt()); + if (channel.flags.trackingEnabled) { + snprintf(text, count - 1, "\xA2"); + } else { + snprintf(text, count - 1, "#%d", channel.channelIndex + 1); + } +} + +bool compare_CHANNEL_SHORT_TITLE_WITHOUT_TRACKING_ICON_value(const Value &a, const Value &b) { + return a.getInt() == b.getInt(); +} + +void CHANNEL_SHORT_TITLE_WITHOUT_TRACKING_ICON_value_to_text(const Value &value, char *text, int count) { Channel &channel = Channel::get(value.getInt()); snprintf(text, count - 1, "#%d", channel.channelIndex + 1); } bool compare_CHANNEL_LONG_TITLE_value(const Value &a, const Value &b) { - return a.getInt() == b.getInt(); + Channel &aChannel = Channel::get(a.getInt()); + Channel &bChannel = Channel::get(b.getInt()); + return aChannel.channelIndex == bChannel.channelIndex && aChannel.flags.trackingEnabled == bChannel.flags.trackingEnabled; } void CHANNEL_LONG_TITLE_value_to_text(const Value &value, char *text, int count) { Channel &channel = Channel::get(value.getInt()); - snprintf(text, count - 1, "%s #%d: %dV/%dA, %s", channel.getBoardName(), channel.channelIndex + 1, - (int)floor(channel.params->U_MAX), (int)floor(channel.params->I_MAX), channel.getRevisionName()); + if (channel.flags.trackingEnabled) { + snprintf(text, count - 1, "\xA2 %s #%d: %dV/%dA, %s", channel.getBoardName(), channel.channelIndex + 1, + (int)floor(channel.params->U_MAX), (int)floor(channel.params->I_MAX), channel.getRevisionName()); + } else { + snprintf(text, count - 1, "%s #%d: %dV/%dA, %s", channel.getBoardName(), channel.channelIndex + 1, + (int)floor(channel.params->U_MAX), (int)floor(channel.params->I_MAX), channel.getRevisionName()); + } } //////////////////////////////////////////////////////////////////////////////// @@ -662,6 +690,7 @@ CompareValueFunction g_compareUserValueFunctions[] = { compare_LESS_THEN_MIN_FLO compare_FLOAT_LIST_value, compare_CHANNEL_TITLE_value, compare_CHANNEL_SHORT_TITLE_value, + compare_CHANNEL_SHORT_TITLE_WITHOUT_TRACKING_ICON_value, compare_CHANNEL_LONG_TITLE_value }; ValueToTextFunction g_userValueToTextFunctions[] = { LESS_THEN_MIN_FLOAT_value_to_text, @@ -698,6 +727,7 @@ ValueToTextFunction g_userValueToTextFunctions[] = { LESS_THEN_MIN_FLOAT_value_t FLOAT_LIST_value_to_text, CHANNEL_TITLE_value_to_text, CHANNEL_SHORT_TITLE_value_to_text, + CHANNEL_SHORT_TITLE_WITHOUT_TRACKING_ICON_value_to_text, CHANNEL_LONG_TITLE_value_to_text }; } // namespace data @@ -1632,6 +1662,13 @@ void data_channel_short_title(data::DataOperationEnum operation, data::Cursor &c } } +void data_channel_short_title_without_tracking_icon(data::DataOperationEnum operation, data::Cursor &cursor, data::Value &value) { + if (operation == data::DATA_OPERATION_GET) { + int iChannel = cursor.i >= 0 ? cursor.i : (g_channel ? g_channel->channelIndex : 0); + value = data::Value(iChannel, VALUE_TYPE_CHANNEL_SHORT_TITLE_WITHOUT_TRACKING_ICON); + } +} + void data_channel_long_title(data::DataOperationEnum operation, data::Cursor &cursor, data::Value &value) { if (operation == data::DATA_OPERATION_GET) { int iChannel = cursor.i >= 0 ? cursor.i : (g_channel ? g_channel->channelIndex : 0); @@ -3834,6 +3871,31 @@ void data_simulator_load2(data::DataOperationEnum operation, data::Cursor &curso #endif +void data_channel_active_coupled_led(data::DataOperationEnum operation, data::Cursor &cursor, data::Value &value) { + if (operation == data::DATA_OPERATION_GET) { + Channel &channel = Channel::get(cursor.i); + if (channel.isOutputEnabled()) { + if (channel.channelIndex == 0 && channel_dispatcher::getCouplingType() == channel_dispatcher::COUPLING_TYPE_PARALLEL) { + value = 2; + } else if (channel.channelIndex == 1 && channel_dispatcher::getCouplingType() == channel_dispatcher::COUPLING_TYPE_PARALLEL) { + value = 0; + } else if (channel.channelIndex == 0 && channel_dispatcher::getCouplingType() == channel_dispatcher::COUPLING_TYPE_SERIES) { + value = 2; + } else if (channel.channelIndex == 1 && channel_dispatcher::getCouplingType() == channel_dispatcher::COUPLING_TYPE_SERIES) { + value = 0; + } else if (channel.channelIndex < 2 && channel_dispatcher::getCouplingType() == channel_dispatcher::COUPLING_TYPE_SPLIT_RAILS) { + value = 2; + } else if (channel_dispatcher::getCouplingType() == channel_dispatcher::COUPLING_TYPE_COMMON_GND) { + value = 2; + } else { + value = 1; + } + } else { + value = 0; + } + } +} + } // namespace gui } // namespace eez diff --git a/src/eez/apps/psu/gui/data.h b/src/eez/apps/psu/gui/data.h index 7d9c95bca..46aa13a2d 100644 --- a/src/eez/apps/psu/gui/data.h +++ b/src/eez/apps/psu/gui/data.h @@ -78,6 +78,7 @@ enum UserValueType { VALUE_TYPE_FLOAT_LIST, VALUE_TYPE_CHANNEL_TITLE, VALUE_TYPE_CHANNEL_SHORT_TITLE, + VALUE_TYPE_CHANNEL_SHORT_TITLE_WITHOUT_TRACKING_ICON, VALUE_TYPE_CHANNEL_LONG_TITLE };