Update TS SoC & min cell voltage on AMS Status msg

This commit is contained in:
Jasper Blanckenburg 2023-03-18 23:06:27 +01:00
parent 583017c22e
commit 5d53db3e05
7 changed files with 68 additions and 49 deletions

View File

@ -41,13 +41,13 @@ protected:
touchgfx::PainterRGB565 ttDivVertPainter;
touchgfx::Line ttDivHoriz;
touchgfx::PainterRGB565 ttDivHorizPainter;
touchgfx::LineProgress tsVoltage;
touchgfx::PainterRGB565 tsVoltagePainter;
touchgfx::LineProgress lvVoltage;
touchgfx::PainterRGB565 lvVoltagePainter;
touchgfx::LineProgress tsSoC;
touchgfx::PainterRGB565 tsSoCPainter;
touchgfx::LineProgress lvSoC;
touchgfx::PainterRGB565 lvSoCPainter;
touchgfx::TextArea tireLabel;
touchgfx::TextArea tsVoltLabel;
touchgfx::TextArea lvVoltLabel;
touchgfx::TextArea tsSoCLabel;
touchgfx::TextArea lvSoCLabel;
DriverViewField field1;
DriverViewField field2;
DriverViewField field3;

View File

@ -49,31 +49,31 @@ DriverViewViewBase::DriverViewViewBase()
ttDivHoriz.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
add(ttDivHoriz);
tsVoltage.setXY(10, 107);
tsVoltage.setProgressIndicatorPosition(0, 0, 40, 150);
tsVoltage.setRange(0, 100);
tsVoltage.setBackground(touchgfx::Bitmap(BITMAP_BAT_BAR_BG_ID));
tsVoltagePainter.setColor(touchgfx::Color::getColorFromRGB(136, 255, 0));
tsVoltage.setPainter(tsVoltagePainter);
tsVoltage.setStart(9, 200);
tsVoltage.setEnd(9, 0);
tsVoltage.setLineWidth(100);
tsVoltage.setLineEndingStyle(touchgfx::Line::BUTT_CAP_ENDING);
tsVoltage.setValue(60);
add(tsVoltage);
tsSoC.setXY(10, 107);
tsSoC.setProgressIndicatorPosition(0, 0, 40, 150);
tsSoC.setRange(0, 100);
tsSoC.setBackground(touchgfx::Bitmap(BITMAP_BAT_BAR_BG_ID));
tsSoCPainter.setColor(touchgfx::Color::getColorFromRGB(136, 255, 0));
tsSoC.setPainter(tsSoCPainter);
tsSoC.setStart(9, 150);
tsSoC.setEnd(9, 0);
tsSoC.setLineWidth(100);
tsSoC.setLineEndingStyle(touchgfx::Line::BUTT_CAP_ENDING);
tsSoC.setValue(60);
add(tsSoC);
lvVoltage.setXY(430, 107);
lvVoltage.setProgressIndicatorPosition(0, 0, 40, 150);
lvVoltage.setRange(0, 100);
lvVoltage.setBackground(touchgfx::Bitmap(BITMAP_BAT_BAR_BG_ID));
lvVoltagePainter.setColor(touchgfx::Color::getColorFromRGB(136, 255, 0));
lvVoltage.setPainter(lvVoltagePainter);
lvVoltage.setStart(9, 200);
lvVoltage.setEnd(9, 0);
lvVoltage.setLineWidth(100);
lvVoltage.setLineEndingStyle(touchgfx::Line::BUTT_CAP_ENDING);
lvVoltage.setValue(80);
add(lvVoltage);
lvSoC.setXY(430, 107);
lvSoC.setProgressIndicatorPosition(0, 0, 40, 150);
lvSoC.setRange(0, 100);
lvSoC.setBackground(touchgfx::Bitmap(BITMAP_BAT_BAR_BG_ID));
lvSoCPainter.setColor(touchgfx::Color::getColorFromRGB(136, 255, 0));
lvSoC.setPainter(lvSoCPainter);
lvSoC.setStart(9, 150);
lvSoC.setEnd(9, 0);
lvSoC.setLineWidth(100);
lvSoC.setLineEndingStyle(touchgfx::Line::BUTT_CAP_ENDING);
lvSoC.setValue(80);
add(lvSoC);
tireLabel.setPosition(165, 82, 150, 25);
tireLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
@ -81,17 +81,17 @@ DriverViewViewBase::DriverViewViewBase()
tireLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_H6UX));
add(tireLabel);
tsVoltLabel.setPosition(10, 82, 40, 25);
tsVoltLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
tsVoltLabel.setLinespacing(0);
tsVoltLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_PHFD));
add(tsVoltLabel);
tsSoCLabel.setPosition(10, 82, 40, 25);
tsSoCLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
tsSoCLabel.setLinespacing(0);
tsSoCLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_PHFD));
add(tsSoCLabel);
lvVoltLabel.setPosition(430, 82, 40, 25);
lvVoltLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
lvVoltLabel.setLinespacing(0);
lvVoltLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_4OBM));
add(lvVoltLabel);
lvSoCLabel.setPosition(430, 82, 40, 25);
lvSoCLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
lvSoCLabel.setLinespacing(0);
lvSoCLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_4OBM));
add(lvSoCLabel);
field1.setXY(0, 0);
add(field1);

View File

@ -27,6 +27,8 @@ public:
virtual ~DriverViewPresenter(){};
void amsUpdated() override;
private:
DriverViewPresenter();

View File

@ -13,6 +13,8 @@ public:
virtual void tearDownScreen();
void setTireTemps(const TireTemps &temps);
void setTSSoC(uint8_t soc);
void setMinCellVolt(float v);
protected:
};

View File

@ -8,3 +8,8 @@ DriverViewPresenter::DriverViewPresenter(DriverViewView &v) : view(v) {}
void DriverViewPresenter::activate() {}
void DriverViewPresenter::deactivate() {}
void DriverViewPresenter::amsUpdated() {
view.setTSSoC(vehicle_state.soc);
view.setMinCellVolt(vehicle_state.min_cell_volt);
}

View File

@ -24,3 +24,13 @@ void DriverViewView::setTireTemps(const TireTemps &temps) {
tireTempRL.setTemp(temps.rl);
tireTempRR.setTemp(temps.rr);
}
void DriverViewView::setTSSoC(uint8_t soc) {
tsSoC.setValue(soc);
tsSoC.invalidate();
}
void DriverViewView::setMinCellVolt(float v) {
field1.setValue(v);
field1.invalidate();
}

View File

@ -298,7 +298,7 @@
},
{
"Type": "LineProgress",
"Name": "tsVoltage",
"Name": "tsSoC",
"X": 10,
"Y": 107,
"Width": 40,
@ -308,7 +308,7 @@
"Green": 255
},
"StartX": 9.0,
"StartY": 200.0,
"StartY": 150.0,
"EndX": 9.0,
"LineWidth": 100.0,
"LineEndingStyle": "Butt",
@ -318,7 +318,7 @@
},
{
"Type": "LineProgress",
"Name": "lvVoltage",
"Name": "lvSoC",
"X": 430,
"Y": 107,
"Width": 40,
@ -328,7 +328,7 @@
"Green": 255
},
"StartX": 9.0,
"StartY": 200.0,
"StartY": 150.0,
"EndX": 9.0,
"LineWidth": 100.0,
"LineEndingStyle": "Butt",
@ -353,7 +353,7 @@
},
{
"Type": "TextArea",
"Name": "tsVoltLabel",
"Name": "tsSoCLabel",
"X": 10,
"Y": 82,
"Width": 40,
@ -368,7 +368,7 @@
},
{
"Type": "TextArea",
"Name": "lvVoltLabel",
"Name": "lvSoCLabel",
"X": 430,
"Y": 82,
"Width": 40,
@ -385,7 +385,7 @@
"Type": "CustomContainerInstance",
"Name": "field1",
"Width": 160,
"Height": 75,
"Height": 80,
"CustomContainerDefinitionName": "DriverViewField"
},
{
@ -393,7 +393,7 @@
"Name": "field2",
"X": 160,
"Width": 160,
"Height": 75,
"Height": 80,
"CustomContainerDefinitionName": "DriverViewField"
},
{
@ -401,7 +401,7 @@
"Name": "field3",
"X": 320,
"Width": 160,
"Height": 75,
"Height": 80,
"CustomContainerDefinitionName": "DriverViewField"
}
],