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::PainterRGB565 ttDivVertPainter;
touchgfx::Line ttDivHoriz; touchgfx::Line ttDivHoriz;
touchgfx::PainterRGB565 ttDivHorizPainter; touchgfx::PainterRGB565 ttDivHorizPainter;
touchgfx::LineProgress tsVoltage; touchgfx::LineProgress tsSoC;
touchgfx::PainterRGB565 tsVoltagePainter; touchgfx::PainterRGB565 tsSoCPainter;
touchgfx::LineProgress lvVoltage; touchgfx::LineProgress lvSoC;
touchgfx::PainterRGB565 lvVoltagePainter; touchgfx::PainterRGB565 lvSoCPainter;
touchgfx::TextArea tireLabel; touchgfx::TextArea tireLabel;
touchgfx::TextArea tsVoltLabel; touchgfx::TextArea tsSoCLabel;
touchgfx::TextArea lvVoltLabel; touchgfx::TextArea lvSoCLabel;
DriverViewField field1; DriverViewField field1;
DriverViewField field2; DriverViewField field2;
DriverViewField field3; DriverViewField field3;

View File

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

View File

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

View File

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

View File

@ -8,3 +8,8 @@ DriverViewPresenter::DriverViewPresenter(DriverViewView &v) : view(v) {}
void DriverViewPresenter::activate() {} void DriverViewPresenter::activate() {}
void DriverViewPresenter::deactivate() {} 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); tireTempRL.setTemp(temps.rl);
tireTempRR.setTemp(temps.rr); 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", "Type": "LineProgress",
"Name": "tsVoltage", "Name": "tsSoC",
"X": 10, "X": 10,
"Y": 107, "Y": 107,
"Width": 40, "Width": 40,
@ -308,7 +308,7 @@
"Green": 255 "Green": 255
}, },
"StartX": 9.0, "StartX": 9.0,
"StartY": 200.0, "StartY": 150.0,
"EndX": 9.0, "EndX": 9.0,
"LineWidth": 100.0, "LineWidth": 100.0,
"LineEndingStyle": "Butt", "LineEndingStyle": "Butt",
@ -318,7 +318,7 @@
}, },
{ {
"Type": "LineProgress", "Type": "LineProgress",
"Name": "lvVoltage", "Name": "lvSoC",
"X": 430, "X": 430,
"Y": 107, "Y": 107,
"Width": 40, "Width": 40,
@ -328,7 +328,7 @@
"Green": 255 "Green": 255
}, },
"StartX": 9.0, "StartX": 9.0,
"StartY": 200.0, "StartY": 150.0,
"EndX": 9.0, "EndX": 9.0,
"LineWidth": 100.0, "LineWidth": 100.0,
"LineEndingStyle": "Butt", "LineEndingStyle": "Butt",
@ -353,7 +353,7 @@
}, },
{ {
"Type": "TextArea", "Type": "TextArea",
"Name": "tsVoltLabel", "Name": "tsSoCLabel",
"X": 10, "X": 10,
"Y": 82, "Y": 82,
"Width": 40, "Width": 40,
@ -368,7 +368,7 @@
}, },
{ {
"Type": "TextArea", "Type": "TextArea",
"Name": "lvVoltLabel", "Name": "lvSoCLabel",
"X": 430, "X": 430,
"Y": 82, "Y": 82,
"Width": 40, "Width": 40,
@ -385,7 +385,7 @@
"Type": "CustomContainerInstance", "Type": "CustomContainerInstance",
"Name": "field1", "Name": "field1",
"Width": 160, "Width": 160,
"Height": 75, "Height": 80,
"CustomContainerDefinitionName": "DriverViewField" "CustomContainerDefinitionName": "DriverViewField"
}, },
{ {
@ -393,7 +393,7 @@
"Name": "field2", "Name": "field2",
"X": 160, "X": 160,
"Width": 160, "Width": 160,
"Height": 75, "Height": 80,
"CustomContainerDefinitionName": "DriverViewField" "CustomContainerDefinitionName": "DriverViewField"
}, },
{ {
@ -401,7 +401,7 @@
"Name": "field3", "Name": "field3",
"X": 320, "X": 320,
"Width": 160, "Width": 160,
"Height": 75, "Height": 80,
"CustomContainerDefinitionName": "DriverViewField" "CustomContainerDefinitionName": "DriverViewField"
} }
], ],