Skip to content

Commit

Permalink
yt upt to 4 values supported, bar graph and yt graph colors changed
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Nov 24, 2019
1 parent 554f564 commit 8cd2490
Show file tree
Hide file tree
Showing 8 changed files with 207 additions and 83 deletions.
184 changes: 135 additions & 49 deletions modular-psu-firmware.eez-project
Original file line number Diff line number Diff line change
Expand Up @@ -1819,7 +1819,7 @@
{
"name": "dlog_values",
"type": "list",
"defaultValue": "[{}, {}]"
"defaultValue": "[{}]"
},
{
"name": "dlog_value_label",
Expand Down Expand Up @@ -43507,46 +43507,60 @@
"left": 10,
"top": 9,
"width": 251,
"height": 68,
"height": 45,
"name": "Values overlay",
"widgets": [
{
"type": "Text",
"type": "Container",
"style": {
"inheritFrom": "overlay"
"inheritFrom": "default"
},
"data": "",
"left": 25,
"top": 0,
"width": 75,
"width": 225,
"height": 22,
"text": "Div",
"focusStyle": {}
},
{
"type": "Text",
"style": {
"inheritFrom": "overlay"
},
"data": "",
"left": 100,
"top": 0,
"width": 75,
"height": 22,
"text": "Offset",
"focusStyle": {}
},
{
"type": "Text",
"style": {
"inheritFrom": "overlay"
},
"data": "",
"left": 175,
"top": 0,
"width": 75,
"height": 22,
"text": "Cursor",
"focusStyle": {}
"name": "Labels",
"widgets": [
{
"type": "Text",
"style": {
"inheritFrom": "overlay"
},
"data": "",
"left": 0,
"top": 0,
"width": 75,
"height": 22,
"text": "Div",
"focusStyle": {}
},
{
"type": "Text",
"style": {
"inheritFrom": "overlay"
},
"data": "",
"left": 75,
"top": 0,
"width": 75,
"height": 22,
"text": "Offset",
"focusStyle": {}
},
{
"type": "Text",
"style": {
"inheritFrom": "overlay"
},
"data": "",
"left": 150,
"top": 0,
"width": 75,
"height": 22,
"text": "Cursor",
"focusStyle": {}
}
]
},
{
"type": "List",
Expand All @@ -43559,7 +43573,7 @@
"left": 0,
"top": 22,
"width": 251,
"height": 46,
"height": 23,
"itemWidget": {
"type": "Container",
"style": {
Expand Down Expand Up @@ -46988,10 +47002,10 @@
"description": "",
"inheritFrom": "default",
"font": "Oswald14",
"color": "#0080c0",
"color": "bar_graph_power",
"backgroundColor": "yt_graph_background",
"activeColor": "yt_graph_background",
"activeBackgroundColor": "#0080c0",
"activeBackgroundColor": "bar_graph_power",
"padding": 0,
"alwaysBuild": true
},
Expand All @@ -47018,6 +47032,54 @@
"padding": 0,
"alwaysBuild": true
},
{
"name": "yt_graph_Y1",
"description": "",
"inheritFrom": "default",
"font": "Oswald14",
"color": "yt_graph_y1",
"backgroundColor": "yt_graph_background",
"activeColor": "yt_graph_background",
"activeBackgroundColor": "yt_graph_y1",
"padding": 0,
"alwaysBuild": true
},
{
"name": "yt_graph_Y2",
"description": "",
"inheritFrom": "default",
"font": "Oswald14",
"color": "yt_graph_y2",
"backgroundColor": "yt_graph_background",
"activeColor": "yt_graph_background",
"activeBackgroundColor": "yt_graph_y2",
"padding": 0,
"alwaysBuild": true
},
{
"name": "yt_graph_Y3",
"description": "",
"inheritFrom": "default",
"font": "Oswald14",
"color": "yt_graph_y3",
"backgroundColor": "yt_graph_background",
"activeColor": "yt_graph_background",
"activeBackgroundColor": "yt_graph_y3",
"padding": 0,
"alwaysBuild": true
},
{
"name": "yt_graph_Y4",
"description": "",
"inheritFrom": "default",
"font": "Oswald14",
"color": "yt_graph_y4",
"backgroundColor": "yt_graph_background",
"activeColor": "yt_graph_background",
"activeBackgroundColor": "yt_graph_y4",
"padding": 0,
"alwaysBuild": true
},
{
"name": "select_enum_item_popup_container",
"inheritFrom": "default_S",
Expand Down Expand Up @@ -439991,6 +440053,18 @@
},
{
"name": "yt_graph_cursor"
},
{
"name": "yt_graph_y1"
},
{
"name": "yt_graph_y2"
},
{
"name": "yt_graph_y3"
},
{
"name": "yt_graph_y4"
}
],
"themes": [
Expand All @@ -440015,9 +440089,9 @@
"#ffff00",
"#ffffff",
"#777dfb",
"#ffb000",
"#c830c8",
"#a1b52e",
"#00ff00",
"#ff00ff",
"#0000ff",
"#d3d3d3",
"#404040",
"#ffff00",
Expand All @@ -440042,7 +440116,11 @@
"#404040",
"#606060",
"#303030",
"#c0c0c0"
"#c0c0c0",
"#00ffff",
"#ff00ff",
"#ffff00",
"#808080"
]
},
{
Expand All @@ -440066,9 +440144,9 @@
"#181e8a",
"#f0f0f0",
"#909090",
"#ffb000",
"#c830c8",
"#a1b52e",
"#00ff00",
"#ff00ff",
"#0000ff",
"#d3d3d3",
"#202020",
"#181e8a",
Expand All @@ -440093,7 +440171,11 @@
"#404040",
"#d0d0d0",
"#ffffff",
"#404040"
"#404040",
"#00ffff",
"#ff00ff",
"#ffff00",
"#808080"
]
},
{
Expand All @@ -440117,9 +440199,9 @@
"#e3e3e3",
"#c0c0c0",
"#808080",
"#ffb000",
"#c830c8",
"#a1b52e",
"#00ff00",
"#ff00ff",
"#0000ff",
"#202020",
"#d0d0d0",
"#ffff00",
Expand All @@ -440144,7 +440226,11 @@
"#d0d0d0",
"#404040",
"#303030",
"#c0c0c0"
"#c0c0c0",
"#00ffff",
"#ff00ff",
"#ffff00",
"#808080"
]
}
]
Expand Down
8 changes: 4 additions & 4 deletions src/eez/gui/widgets/yt_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include <eez/gui/widget.h>

static const int MAX_NUM_OF_Y_VALUES = 4;

namespace eez {

enum {
Expand All @@ -30,8 +32,6 @@ enum {

namespace gui {

static const int MAX_DLOG_VALUES = 6;

struct YTGraphWidgetState {
WidgetState genericState;
uint32_t refreshCounter;
Expand All @@ -40,8 +40,8 @@ struct YTGraphWidgetState {
uint32_t historyValuePosition;
uint8_t ytGraphUpdateMethod;
uint32_t cursorPosition;
float valuePerDiv[MAX_DLOG_VALUES];
float valueOffset[MAX_DLOG_VALUES];
float valuePerDiv[MAX_NUM_OF_Y_VALUES];
float valueOffset[MAX_NUM_OF_Y_VALUES];
};

void YTGraphWidget_draw(const WidgetCursor &widgetCursor);
Expand Down
12 changes: 6 additions & 6 deletions src/eez/modules/psu/dlog_record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ int startImmediately() {
if (g_recording.parameters.logVoltage[iChannel]) {
columns |= 1 << (4 * iChannel);
++g_recording.totalDlogValues;
if (g_recording.numVisibleDlogValues < dlog_view::MAX_VISIBLE_DLOG_VALUES) {
g_recording.dlogValues[g_recording.numVisibleDlogValues].dlogValueType = (dlog_view::DlogValueType)(3 * g_recording.numVisibleDlogValues + dlog_view::DLOG_VALUE_CH1_U);
if (g_recording.numVisibleDlogValues < MAX_NUM_OF_Y_VALUES) {
g_recording.dlogValues[g_recording.numVisibleDlogValues].dlogValueType = (dlog_view::DlogValueType)(3 * iChannel + dlog_view::DLOG_VALUE_CH1_U);
float perDiv = channel_dispatcher::getUMax(Channel::get(iChannel)) / dlog_view::NUM_VERT_DIVISIONS;
g_recording.dlogValues[g_recording.numVisibleDlogValues].perDiv = gui::data::Value(roundPrec(perDiv, 0.01f), UNIT_VOLT);
g_recording.dlogValues[g_recording.numVisibleDlogValues].offset = gui::data::Value(roundPrec(-perDiv * dlog_view::NUM_VERT_DIVISIONS / 2, 0.01f), UNIT_VOLT);
Expand All @@ -295,8 +295,8 @@ int startImmediately() {
if (g_recording.parameters.logCurrent[iChannel]) {
columns |= 2 << (4 * iChannel);
++g_recording.totalDlogValues;
if (g_recording.numVisibleDlogValues < dlog_view::MAX_VISIBLE_DLOG_VALUES) {
g_recording.dlogValues[g_recording.numVisibleDlogValues].dlogValueType = (dlog_view::DlogValueType)(3 * g_recording.numVisibleDlogValues + dlog_view::DLOG_VALUE_CH1_I);
if (g_recording.numVisibleDlogValues < MAX_NUM_OF_Y_VALUES) {
g_recording.dlogValues[g_recording.numVisibleDlogValues].dlogValueType = (dlog_view::DlogValueType)(3 * iChannel + dlog_view::DLOG_VALUE_CH1_I);
float perDiv = channel_dispatcher::getIMax(Channel::get(iChannel)) / dlog_view::NUM_VERT_DIVISIONS;
g_recording.dlogValues[g_recording.numVisibleDlogValues].perDiv = gui::data::Value(roundPrec(perDiv, 0.01f), UNIT_AMPER);
g_recording.dlogValues[g_recording.numVisibleDlogValues].offset = gui::data::Value(roundPrec(-perDiv * dlog_view::NUM_VERT_DIVISIONS / 2, 0.01f), UNIT_AMPER);
Expand All @@ -307,8 +307,8 @@ int startImmediately() {
if (g_recording.parameters.logPower[iChannel]) {
columns |= 4 << (4 * iChannel);
++g_recording.totalDlogValues;
if (g_recording.numVisibleDlogValues < dlog_view::MAX_VISIBLE_DLOG_VALUES) {
g_recording.dlogValues[g_recording.numVisibleDlogValues].dlogValueType = (dlog_view::DlogValueType)(3 * g_recording.numVisibleDlogValues + dlog_view::DLOG_VALUE_CH1_P);
if (g_recording.numVisibleDlogValues < MAX_NUM_OF_Y_VALUES) {
g_recording.dlogValues[g_recording.numVisibleDlogValues].dlogValueType = (dlog_view::DlogValueType)(3 * iChannel + dlog_view::DLOG_VALUE_CH1_P);
float perDiv = channel_dispatcher::getPowerMaxLimit(Channel::get(iChannel)) / dlog_view::NUM_VERT_DIVISIONS;
g_recording.dlogValues[g_recording.numVisibleDlogValues].perDiv = gui::data::Value(roundPrec(perDiv, 0.01f), UNIT_WATT);
g_recording.dlogValues[g_recording.numVisibleDlogValues].offset = gui::data::Value(roundPrec(-perDiv * dlog_view::NUM_VERT_DIVISIONS / 2, 0.01f), UNIT_WATT);
Expand Down
12 changes: 6 additions & 6 deletions src/eez/modules/psu/dlog_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ void openFile(const char *filePath) {

g_recording.parameters.logVoltage[iChannel] = 1;

if (g_recording.numVisibleDlogValues < dlog_view::MAX_VISIBLE_DLOG_VALUES) {
g_recording.dlogValues[g_recording.numVisibleDlogValues].dlogValueType = (dlog_view::DlogValueType)(3 * g_recording.numVisibleDlogValues + dlog_view::DLOG_VALUE_CH1_U);
if (g_recording.numVisibleDlogValues < MAX_NUM_OF_Y_VALUES) {
g_recording.dlogValues[g_recording.numVisibleDlogValues].dlogValueType = (dlog_view::DlogValueType)(3 * iChannel + dlog_view::DLOG_VALUE_CH1_U);

// TODO this must be read from the file
float perDiv = channel_dispatcher::getUMax(Channel::get(iChannel)) / dlog_view::NUM_VERT_DIVISIONS;
Expand All @@ -224,8 +224,8 @@ void openFile(const char *filePath) {

g_recording.parameters.logCurrent[iChannel] = 1;

if (g_recording.numVisibleDlogValues < dlog_view::MAX_VISIBLE_DLOG_VALUES) {
g_recording.dlogValues[g_recording.numVisibleDlogValues].dlogValueType = (dlog_view::DlogValueType)(3 * g_recording.numVisibleDlogValues + dlog_view::DLOG_VALUE_CH1_I);
if (g_recording.numVisibleDlogValues < MAX_NUM_OF_Y_VALUES) {
g_recording.dlogValues[g_recording.numVisibleDlogValues].dlogValueType = (dlog_view::DlogValueType)(3 * iChannel + dlog_view::DLOG_VALUE_CH1_I);

// TODO this must be read from the file
float perDiv = channel_dispatcher::getIMax(Channel::get(iChannel)) / dlog_view::NUM_VERT_DIVISIONS;
Expand All @@ -242,8 +242,8 @@ void openFile(const char *filePath) {

g_recording.parameters.logPower[iChannel] = 1;

if (g_recording.numVisibleDlogValues < dlog_view::MAX_VISIBLE_DLOG_VALUES) {
g_recording.dlogValues[g_recording.numVisibleDlogValues].dlogValueType = (dlog_view::DlogValueType)(3 * g_recording.numVisibleDlogValues + dlog_view::DLOG_VALUE_CH1_P);
if (g_recording.numVisibleDlogValues < MAX_NUM_OF_Y_VALUES) {
g_recording.dlogValues[g_recording.numVisibleDlogValues].dlogValueType = (dlog_view::DlogValueType)(3 * iChannel + dlog_view::DLOG_VALUE_CH1_P);

// TODO this should be stored inside DLOG file
float perDiv = channel_dispatcher::getPowerMaxLimit(Channel::get(iChannel)) / dlog_view::NUM_VERT_DIVISIONS;
Expand Down
Loading

0 comments on commit 8cd2490

Please sign in to comment.