Skip to content

Commit

Permalink
gauge debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Jul 28, 2021
1 parent bb25dde commit ff92e9e
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/eez/flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@ static FlowState *initFlowState(Assets *assets, int flowIndex) {
}

for (unsigned i = 0; i < flow->localVariables.count; i++) {
auto &value = *flow->localVariables.item(assets, i);
flowState->values[flow->nInputValues + i] = value;
auto value = flow->localVariables.item(assets, i);
flowState->values[flow->nInputValues + i] = *value;
}

return flowState;
Expand Down
2 changes: 1 addition & 1 deletion src/eez/gui/assets.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct Widget {
int16_t y;
int16_t w;
int16_t h;
uint16_t style;
int16_t style;
};

struct ContainerWidget : public Widget {
Expand Down
7 changes: 7 additions & 0 deletions src/eez/gui/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,13 @@ void drawArcBar(int xCenter, int yCenter, int radius, float fromAngleDeg, float
}

void fillArcBar(int xCenter, int yCenter, int radius, float fromAngleDeg, float toAngleDeg, int width) {
if (isNaN(fromAngleDeg) || fromAngleDeg < 0) {
fromAngleDeg = 0;
}
if (isNaN(toAngleDeg) || toAngleDeg > 360.0f) {
toAngleDeg = 360.0f;
}

static const size_t N = 200;
int16_t vx[N + 8];
int16_t vy[N + 8];
Expand Down
6 changes: 3 additions & 3 deletions src/eez/gui/widgets/bar_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ namespace gui {
#define BAR_GRAPH_DO_NOT_DISPLAY_VALUE (1 << 4)

struct BarGraphWidget : public Widget {
uint16_t textStyle;
int16_t textStyle;
int16_t line1Data;
uint16_t line1Style;
int16_t line1Style;
int16_t line2Data;
uint16_t line2Style;
int16_t line2Style;
uint8_t orientation; // BAR_GRAPH_ORIENTATION_...
};

Expand Down
2 changes: 1 addition & 1 deletion src/eez/gui/widgets/button.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace gui {
struct ButtonWidget : public Widget {
AssetsPtr<const char> text;
int16_t enabled;
uint16_t disabledStyle;
int16_t disabledStyle;
};

} // namespace gui
Expand Down
2 changes: 1 addition & 1 deletion src/eez/gui/widgets/button_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace eez {
namespace gui {

struct ButtonGroupWidget : public Widget {
uint16_t selectedStyle;
int16_t selectedStyle;
};

EnumFunctionType BUTTON_GROUP_enum = nullptr;
Expand Down
8 changes: 4 additions & 4 deletions src/eez/gui/widgets/gauge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ struct GaugeWidget : public Widget {
int16_t min;
int16_t max;
int16_t threashold;
uint16_t barStyle;
uint16_t thresholdStyle;
int16_t barStyle;
int16_t thresholdStyle;
};

EnumFunctionType GAUGE_enum = nullptr;
Expand All @@ -55,8 +55,8 @@ DrawFunctionType GAUGE_draw = [](const WidgetCursor &widgetCursor) {

static const int BORDER_WIDTH = 32;
static const int BAR_WIDTH = 16;
float min = 0.0f;
float max = 40.0f;
float min = get(widgetCursor, widget->min).toFloat();
float max = get(widgetCursor, widget->max).toFloat();

const Style* barStyle = getStyle(widget->barStyle);
mcu::display::setColor(barStyle->color);
Expand Down
6 changes: 3 additions & 3 deletions src/eez/gui/widgets/list_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ namespace gui {
struct ListGraphWidget : public Widget {
int16_t dwellData;
int16_t y1Data;
uint16_t y1Style;
int16_t y1Style;
int16_t y2Data;
uint16_t y2Style;
int16_t y2Style;
int16_t cursorData;
uint16_t cursorStyle;
int16_t cursorStyle;
};

struct ListGraphWidgetState {
Expand Down
4 changes: 2 additions & 2 deletions src/eez/gui/widgets/scroll_bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ namespace eez {
namespace gui {

struct ScrollBarWidget : public Widget {
uint16_t thumbStyle;
uint16_t buttonsStyle;
int16_t thumbStyle;
int16_t buttonsStyle;
AssetsPtr<const char> leftButtonText;
AssetsPtr<const char> rightButtonText;
};
Expand Down
2 changes: 1 addition & 1 deletion src/eez/gui/widgets/up_down.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace gui {
struct UpDownWidget : public Widget {
AssetsPtr<const char> downButtonText;
AssetsPtr<const char> upButtonText;
uint16_t buttonsStyle;
int16_t buttonsStyle;
};

EnumFunctionType UP_DOWN_enum = nullptr;
Expand Down

0 comments on commit ff92e9e

Please sign in to comment.