From 5d53db3e05d61427971fcd6904963a33867f821e Mon Sep 17 00:00:00 2001 From: "Jasper v. Blanckenburg" Date: Sat, 18 Mar 2023 23:06:27 +0100 Subject: [PATCH] Update TS SoC & min cell voltage on AMS Status msg --- .../driverview_screen/DriverViewViewBase.hpp | 12 ++-- .../driverview_screen/DriverViewViewBase.cpp | 68 +++++++++---------- .../driverview_screen/DriverViewPresenter.hpp | 2 + .../gui/driverview_screen/DriverViewView.hpp | 2 + .../driverview_screen/DriverViewPresenter.cpp | 5 ++ .../src/driverview_screen/DriverViewView.cpp | 10 +++ TouchGFX/steering-wheel.touchgfx | 18 ++--- 7 files changed, 68 insertions(+), 49 deletions(-) diff --git a/TouchGFX/generated/gui_generated/include/gui_generated/driverview_screen/DriverViewViewBase.hpp b/TouchGFX/generated/gui_generated/include/gui_generated/driverview_screen/DriverViewViewBase.hpp index 806979d..e7da2fb 100644 --- a/TouchGFX/generated/gui_generated/include/gui_generated/driverview_screen/DriverViewViewBase.hpp +++ b/TouchGFX/generated/gui_generated/include/gui_generated/driverview_screen/DriverViewViewBase.hpp @@ -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; diff --git a/TouchGFX/generated/gui_generated/src/driverview_screen/DriverViewViewBase.cpp b/TouchGFX/generated/gui_generated/src/driverview_screen/DriverViewViewBase.cpp index d880bd5..8677596 100644 --- a/TouchGFX/generated/gui_generated/src/driverview_screen/DriverViewViewBase.cpp +++ b/TouchGFX/generated/gui_generated/src/driverview_screen/DriverViewViewBase.cpp @@ -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); diff --git a/TouchGFX/gui/include/gui/driverview_screen/DriverViewPresenter.hpp b/TouchGFX/gui/include/gui/driverview_screen/DriverViewPresenter.hpp index fd366ef..243574f 100644 --- a/TouchGFX/gui/include/gui/driverview_screen/DriverViewPresenter.hpp +++ b/TouchGFX/gui/include/gui/driverview_screen/DriverViewPresenter.hpp @@ -27,6 +27,8 @@ public: virtual ~DriverViewPresenter(){}; + void amsUpdated() override; + private: DriverViewPresenter(); diff --git a/TouchGFX/gui/include/gui/driverview_screen/DriverViewView.hpp b/TouchGFX/gui/include/gui/driverview_screen/DriverViewView.hpp index 6cda2a0..d727a02 100644 --- a/TouchGFX/gui/include/gui/driverview_screen/DriverViewView.hpp +++ b/TouchGFX/gui/include/gui/driverview_screen/DriverViewView.hpp @@ -13,6 +13,8 @@ public: virtual void tearDownScreen(); void setTireTemps(const TireTemps &temps); + void setTSSoC(uint8_t soc); + void setMinCellVolt(float v); protected: }; diff --git a/TouchGFX/gui/src/driverview_screen/DriverViewPresenter.cpp b/TouchGFX/gui/src/driverview_screen/DriverViewPresenter.cpp index 89f2653..50a1be7 100644 --- a/TouchGFX/gui/src/driverview_screen/DriverViewPresenter.cpp +++ b/TouchGFX/gui/src/driverview_screen/DriverViewPresenter.cpp @@ -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); +} diff --git a/TouchGFX/gui/src/driverview_screen/DriverViewView.cpp b/TouchGFX/gui/src/driverview_screen/DriverViewView.cpp index 3c289a4..8963bca 100644 --- a/TouchGFX/gui/src/driverview_screen/DriverViewView.cpp +++ b/TouchGFX/gui/src/driverview_screen/DriverViewView.cpp @@ -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(); +} diff --git a/TouchGFX/steering-wheel.touchgfx b/TouchGFX/steering-wheel.touchgfx index 3d42090..f829109 100644 --- a/TouchGFX/steering-wheel.touchgfx +++ b/TouchGFX/steering-wheel.touchgfx @@ -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" } ],