diff --git a/Core/Inc/vehicle.h b/Core/Inc/vehicle.h index 54083cf..9480f74 100644 --- a/Core/Inc/vehicle.h +++ b/Core/Inc/vehicle.h @@ -94,6 +94,8 @@ typedef struct { ASState as_state; Mission active_mission; + int sdc_closed; + R2DProgress r2d_progress; struct { int invl_ready : 1; diff --git a/Core/Src/vehicle.c b/Core/Src/vehicle.c index a52ef69..a62bfd0 100644 --- a/Core/Src/vehicle.c +++ b/Core/Src/vehicle.c @@ -85,6 +85,7 @@ void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data) { break; case CAN_ID_AMS_STATUS: vehicle_state.ts_state = data[0] & 0x7F; + vehicle_state.sdc_closed = (data[0] & 0x80) >> 7; vehicle_state.soc = data[1]; ptr = &data[2]; vehicle_state.min_cell_volt = diff --git a/STM32Make.make b/STM32Make.make index 5781458..032b768 100644 --- a/STM32Make.make +++ b/STM32Make.make @@ -363,6 +363,7 @@ TouchGFX/generated/gui_generated/src/containers/DebugViewItemBase.cpp \ TouchGFX/generated/gui_generated/src/containers/DebugViewLineBase.cpp \ TouchGFX/generated/gui_generated/src/containers/DriverViewFieldBase.cpp \ TouchGFX/generated/gui_generated/src/containers/DriverViewFieldSelectionBase.cpp \ +TouchGFX/generated/gui_generated/src/containers/DriverViewStatusItemBase.cpp \ TouchGFX/generated/gui_generated/src/containers/ErrorPopupBase.cpp \ TouchGFX/generated/gui_generated/src/containers/MissionSelectElementBase.cpp \ TouchGFX/generated/gui_generated/src/containers/TemperatureBase.cpp \ @@ -380,6 +381,7 @@ TouchGFX/generated/images/src/image_bat_bar_bg.cpp \ TouchGFX/generated/images/src/image_logo_dv_small.cpp \ TouchGFX/generated/images/src/image_logo_dv_small_white.cpp \ TouchGFX/generated/images/src/image_precharge_bg.cpp \ +TouchGFX/generated/images/src/image_prog_horiz_bg.cpp \ TouchGFX/generated/texts/src/LanguageGb.cpp \ TouchGFX/generated/texts/src/Texts.cpp \ TouchGFX/generated/texts/src/TypedTextDatabase.cpp \ @@ -392,6 +394,7 @@ TouchGFX/gui/src/containers/DebugViewItem.cpp \ TouchGFX/gui/src/containers/DebugViewLine.cpp \ TouchGFX/gui/src/containers/DriverViewField.cpp \ TouchGFX/gui/src/containers/DriverViewFieldSelection.cpp \ +TouchGFX/gui/src/containers/DriverViewStatusItem.cpp \ TouchGFX/gui/src/containers/ErrorPopup.cpp \ TouchGFX/gui/src/containers/MissionSelectElement.cpp \ TouchGFX/gui/src/containers/Temperature.cpp \ diff --git a/TouchGFX/assets/texts/texts.xml b/TouchGFX/assets/texts/texts.xml index d7a7feb..6cad9a7 100644 --- a/TouchGFX/assets/texts/texts.xml +++ b/TouchGFX/assets/texts/texts.xml @@ -4,6 +4,29 @@ + + + PDU + + + SCS + + + SDC + + + R2D + + + TS + + + INV + + + AMS + + AMS ErrOr @@ -145,6 +168,9 @@ + + + MOTOR diff --git a/TouchGFX/generated/gui_generated/include/gui_generated/containers/DriverViewStatusItemBase.hpp b/TouchGFX/generated/gui_generated/include/gui_generated/containers/DriverViewStatusItemBase.hpp new file mode 100644 index 0000000..fe69885 --- /dev/null +++ b/TouchGFX/generated/gui_generated/include/gui_generated/containers/DriverViewStatusItemBase.hpp @@ -0,0 +1,34 @@ +/*********************************************************************************/ +/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/ +/*********************************************************************************/ +#ifndef DRIVERVIEWSTATUSITEMBASE_HPP +#define DRIVERVIEWSTATUSITEMBASE_HPP + +#include +#include +#include +#include + +class DriverViewStatusItemBase : public touchgfx::Container +{ +public: + DriverViewStatusItemBase(); + virtual ~DriverViewStatusItemBase(); + virtual void initialize(); + +protected: + FrontendApplication& application() { + return *static_cast(touchgfx::Application::getInstance()); + } + + /* + * Member Declarations + */ + touchgfx::BoxWithBorder bg; + touchgfx::TextArea text; + +private: + +}; + +#endif // DRIVERVIEWSTATUSITEMBASE_HPP 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 534cc91..5877361 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 @@ -11,15 +11,17 @@ #include #include #include -#include #include #include #include #include #include #include +#include +#include #include #include +#include class DriverViewViewBase : public touchgfx::View { @@ -73,7 +75,6 @@ protected: touchgfx::PainterRGB565 lvSoCPainter; touchgfx::TextArea tsSoCLabel; touchgfx::TextArea lvSoCLabel; - ErrorPopup errorPopup; touchgfx::Container drivetrainTemps; touchgfx::TextArea motorTempLabel; Temperature motorTempL; @@ -102,10 +103,18 @@ protected: DriverViewField field2; DriverViewField field1; touchgfx::Container statusBar; + touchgfx::ListLayout statusItems; + DriverViewStatusItem statusTS_R2D; + DriverViewStatusItem statusAMS; + DriverViewStatusItem statusSDC; + DriverViewStatusItem statusSCS; + DriverViewStatusItem statusPDU; + DriverViewStatusItem statusINV; touchgfx::BoxProgress progressBar; touchgfx::TextArea prechargeLabel; touchgfx::TextArea r2dLabel; touchgfx::TextAreaWithOneWildcard r2dProgressLabel; + ErrorPopup errorPopup; private: diff --git a/TouchGFX/generated/gui_generated/src/containers/DriverViewStatusItemBase.cpp b/TouchGFX/generated/gui_generated/src/containers/DriverViewStatusItemBase.cpp new file mode 100644 index 0000000..1fb9f9a --- /dev/null +++ b/TouchGFX/generated/gui_generated/src/containers/DriverViewStatusItemBase.cpp @@ -0,0 +1,33 @@ +/*********************************************************************************/ +/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/ +/*********************************************************************************/ +#include +#include +#include + +DriverViewStatusItemBase::DriverViewStatusItemBase() +{ + setWidth(75); + setHeight(33); + bg.setPosition(0, 0, 75, 33); + bg.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0)); + bg.setBorderColor(touchgfx::Color::getColorFromRGB(255, 255, 255)); + bg.setBorderSize(1); + add(bg); + + text.setPosition(0, 4, 75, 25); + text.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255)); + text.setLinespacing(0); + text.setTypedText(touchgfx::TypedText(T___SINGLEUSE_F9I5)); + add(text); +} + +DriverViewStatusItemBase::~DriverViewStatusItemBase() +{ + +} + +void DriverViewStatusItemBase::initialize() +{ + +} diff --git a/TouchGFX/generated/gui_generated/src/driverview_screen/DriverViewViewBase.cpp b/TouchGFX/generated/gui_generated/src/driverview_screen/DriverViewViewBase.cpp index 4fe3bfa..153dd2b 100644 --- a/TouchGFX/generated/gui_generated/src/driverview_screen/DriverViewViewBase.cpp +++ b/TouchGFX/generated/gui_generated/src/driverview_screen/DriverViewViewBase.cpp @@ -54,10 +54,6 @@ DriverViewViewBase::DriverViewViewBase() : lvSoCLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_4OBM)); add(lvSoCLabel); - errorPopup.setXY(15, 155); - errorPopup.setVisible(false); - add(errorPopup); - drivetrainTemps.setPosition(315, 130, 150, 175); motorTempLabel.setPosition(0, 90, 150, 25); motorTempLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255)); @@ -169,6 +165,27 @@ DriverViewViewBase::DriverViewViewBase() : add(dataFields); statusBar.setPosition(15, 15, 450, 33); + statusItems.setXY(0, 0); + statusItems.setDirection(touchgfx::EAST); + statusTS_R2D.setXY(0, 0); + statusItems.add(statusTS_R2D); + + + statusItems.add(statusAMS); + + statusSDC.setXY(150, 0); + statusItems.add(statusSDC); + + statusSCS.setXY(225, 0); + statusItems.add(statusSCS); + + statusItems.add(statusPDU); + + statusINV.setXY(375, 0); + statusItems.add(statusINV); + + statusBar.add(statusItems); + progressBar.setXY(0, 0); progressBar.setProgressIndicatorPosition(0, 0, 480, 55); progressBar.setRange(0, 100); @@ -201,6 +218,10 @@ DriverViewViewBase::DriverViewViewBase() : statusBar.add(r2dProgressLabel); add(statusBar); + + errorPopup.setXY(15, 155); + errorPopup.setVisible(false); + add(errorPopup); } DriverViewViewBase::~DriverViewViewBase() @@ -210,7 +231,6 @@ DriverViewViewBase::~DriverViewViewBase() void DriverViewViewBase::setupScreen() { - errorPopup.initialize(); motorTempL.initialize(); motorTempR.initialize(); invTempR.initialize(); @@ -227,6 +247,13 @@ void DriverViewViewBase::setupScreen() field3.initialize(); field2.initialize(); field1.initialize(); + statusTS_R2D.initialize(); + statusAMS.initialize(); + statusSDC.initialize(); + statusSCS.initialize(); + statusPDU.initialize(); + statusINV.initialize(); + errorPopup.initialize(); } void DriverViewViewBase::handleKeyEvent(uint8_t key) diff --git a/TouchGFX/generated/texts/cache/LanguageCpp_Gb.cache b/TouchGFX/generated/texts/cache/LanguageCpp_Gb.cache index d7a54a3..fa1b4a1 100644 --- a/TouchGFX/generated/texts/cache/LanguageCpp_Gb.cache +++ b/TouchGFX/generated/texts/cache/LanguageCpp_Gb.cache @@ -1 +1 @@ -{"remap":"yes","language":"GB","language_index":0,"indices":[["128","T_ERROR_AMS"],["176","T_DEBUGVIEWFIELD_TITLE"],["176","T_DRIVERVIEWFIELD_TITLE"],["176","T_NUMBERSMALLWILDCARD"],["293","T_FIELD_BBAL"],["256","T_FIELD_TSVOLTVEH"],["249","T_FIELD_TSVOLTBAT"],["269","T_FIELD_LVSOC"],["287","T_FIELD_TSSOC"],["303","T_FIELD_MAXCELLTEMP"],["308","T_FIELD_TIREFL"],["313","T_FIELD_TIREFR"],["318","T_FIELD_TIRERL"],["323","T_FIELD_TIRERR"],["298","T_FIELD_LAPCOUNT"],["186","T_FIELD_INICHKSTATE"],["263","T_FIELD_ERR"],["341","T_FIELD_SDC"],["202","T_FIELD_INVRREADY"],["194","T_FIELD_INVLREADY"],["218","T_FIELD_R2DPROGRESS"],["210","T_FIELD_ACTIVEMISSION"],["178","T_FIELD_ASSTATE"],["234","T_FIELD_TSSTATE"],["176","T_NUMBERWILDCARD"],["176","T_DEFAULTWILDCARD_CENTERED"],["176","T_DEFAULTWILDCARD_RIGHTALIGNED"],["333","T_FIELD_TSCURRENT"],["328","T_FIELD_MINCELLVOLT"],["281","T_FIELD_SPEED"],["95","T_INSPECTION_HUGE"],["158","T_EBS_HUGE"],["117","T_TRACKDRIVE_HUGE"],["138","T_AUTOX_HUGE"],["226","T_SKIDPAD_HUGE"],["82","T_ACCEL_HUGE"],["34","T_INVALID_HUGE"],["67","T_MANUAL"],["95","T_INSPECTION"],["158","T_EBS"],["117","T_TRACKDRIVE"],["138","T_AUTOX"],["226","T_SKIDPAD"],["82","T_ACCEL"],["275","T___SINGLEUSE_JN2J"],["167","T___SINGLEUSE_ZP7N"],["176","T___SINGLEUSE_9L8R"],["16","T___SINGLEUSE_1NKF"],["176","T___SINGLEUSE_J5UH"],["337","T___SINGLEUSE_NGUK"],["176","T___SINGLEUSE_4E84"],["176","T___SINGLEUSE_YTAB"],["106","T___SINGLEUSE_RWCE"],["148","T___SINGLEUSE_HMH2"],["345","T___SINGLEUSE_4OBM"],["334","T___SINGLEUSE_PHFD"],["242","T___SINGLEUSE_H6UX"],["176","T___SINGLEUSE_20H3"],["17","T___SINGLEUSE_SDGP"],["51","T___SINGLEUSE_M5X7"],["0","T___SINGLEUSE_6GPV"]]} \ No newline at end of file +{"remap":"yes","language":"GB","language_index":0,"indices":[["345","T_PDU"],["353","T_SCS"],["357","T_SDC"],["349","T_R2D"],["342","T_TS"],["337","T_INV"],["333","T_AMS"],["128","T_ERROR_AMS"],["176","T_DEBUGVIEWFIELD_TITLE"],["176","T_DRIVERVIEWFIELD_TITLE"],["176","T_NUMBERSMALLWILDCARD"],["293","T_FIELD_BBAL"],["256","T_FIELD_TSVOLTVEH"],["249","T_FIELD_TSVOLTBAT"],["269","T_FIELD_LVSOC"],["287","T_FIELD_TSSOC"],["303","T_FIELD_MAXCELLTEMP"],["308","T_FIELD_TIREFL"],["313","T_FIELD_TIREFR"],["318","T_FIELD_TIRERL"],["323","T_FIELD_TIRERR"],["298","T_FIELD_LAPCOUNT"],["186","T_FIELD_INICHKSTATE"],["263","T_FIELD_ERR"],["357","T_FIELD_SDC"],["202","T_FIELD_INVRREADY"],["194","T_FIELD_INVLREADY"],["218","T_FIELD_R2DPROGRESS"],["210","T_FIELD_ACTIVEMISSION"],["178","T_FIELD_ASSTATE"],["234","T_FIELD_TSSTATE"],["176","T_NUMBERWILDCARD"],["176","T_DEFAULTWILDCARD_CENTERED"],["176","T_DEFAULTWILDCARD_RIGHTALIGNED"],["341","T_FIELD_TSCURRENT"],["328","T_FIELD_MINCELLVOLT"],["281","T_FIELD_SPEED"],["95","T_INSPECTION_HUGE"],["158","T_EBS_HUGE"],["117","T_TRACKDRIVE_HUGE"],["138","T_AUTOX_HUGE"],["226","T_SKIDPAD_HUGE"],["82","T_ACCEL_HUGE"],["34","T_INVALID_HUGE"],["67","T_MANUAL"],["95","T_INSPECTION"],["158","T_EBS"],["117","T_TRACKDRIVE"],["138","T_AUTOX"],["226","T_SKIDPAD"],["82","T_ACCEL"],["16","T___SINGLEUSE_F9I5"],["275","T___SINGLEUSE_JN2J"],["167","T___SINGLEUSE_ZP7N"],["176","T___SINGLEUSE_9L8R"],["16","T___SINGLEUSE_1NKF"],["176","T___SINGLEUSE_J5UH"],["349","T___SINGLEUSE_NGUK"],["176","T___SINGLEUSE_4E84"],["176","T___SINGLEUSE_YTAB"],["106","T___SINGLEUSE_RWCE"],["148","T___SINGLEUSE_HMH2"],["361","T___SINGLEUSE_4OBM"],["342","T___SINGLEUSE_PHFD"],["242","T___SINGLEUSE_H6UX"],["176","T___SINGLEUSE_20H3"],["17","T___SINGLEUSE_SDGP"],["51","T___SINGLEUSE_M5X7"],["0","T___SINGLEUSE_6GPV"]]} \ No newline at end of file diff --git a/TouchGFX/generated/texts/cache/TextKeysAndLanguages.cache b/TouchGFX/generated/texts/cache/TextKeysAndLanguages.cache index 00ad296..1abb07a 100644 --- a/TouchGFX/generated/texts/cache/TextKeysAndLanguages.cache +++ b/TouchGFX/generated/texts/cache/TextKeysAndLanguages.cache @@ -1 +1 @@ -{"languages":["GB"],"textids":["T_ERROR_AMS","T_DEBUGVIEWFIELD_TITLE","T_DRIVERVIEWFIELD_TITLE","T_NUMBERSMALLWILDCARD","T_FIELD_BBAL","T_FIELD_TSVOLTVEH","T_FIELD_TSVOLTBAT","T_FIELD_LVSOC","T_FIELD_TSSOC","T_FIELD_MAXCELLTEMP","T_FIELD_TIREFL","T_FIELD_TIREFR","T_FIELD_TIRERL","T_FIELD_TIRERR","T_FIELD_LAPCOUNT","T_FIELD_INICHKSTATE","T_FIELD_ERR","T_FIELD_SDC","T_FIELD_INVRREADY","T_FIELD_INVLREADY","T_FIELD_R2DPROGRESS","T_FIELD_ACTIVEMISSION","T_FIELD_ASSTATE","T_FIELD_TSSTATE","T_NUMBERWILDCARD","T_DEFAULTWILDCARD_CENTERED","T_DEFAULTWILDCARD_RIGHTALIGNED","T_FIELD_TSCURRENT","T_FIELD_MINCELLVOLT","T_FIELD_SPEED","T_INSPECTION_HUGE","T_EBS_HUGE","T_TRACKDRIVE_HUGE","T_AUTOX_HUGE","T_SKIDPAD_HUGE","T_ACCEL_HUGE","T_INVALID_HUGE","T_MANUAL","T_INSPECTION","T_EBS","T_TRACKDRIVE","T_AUTOX","T_SKIDPAD","T_ACCEL","T___SINGLEUSE_JN2J","T___SINGLEUSE_ZP7N","T___SINGLEUSE_9L8R","T___SINGLEUSE_1NKF","T___SINGLEUSE_J5UH","T___SINGLEUSE_NGUK","T___SINGLEUSE_4E84","T___SINGLEUSE_YTAB","T___SINGLEUSE_RWCE","T___SINGLEUSE_HMH2","T___SINGLEUSE_4OBM","T___SINGLEUSE_PHFD","T___SINGLEUSE_H6UX","T___SINGLEUSE_20H3","T___SINGLEUSE_SDGP","T___SINGLEUSE_M5X7","T___SINGLEUSE_6GPV"]} \ No newline at end of file +{"languages":["GB"],"textids":["T_PDU","T_SCS","T_SDC","T_R2D","T_TS","T_INV","T_AMS","T_ERROR_AMS","T_DEBUGVIEWFIELD_TITLE","T_DRIVERVIEWFIELD_TITLE","T_NUMBERSMALLWILDCARD","T_FIELD_BBAL","T_FIELD_TSVOLTVEH","T_FIELD_TSVOLTBAT","T_FIELD_LVSOC","T_FIELD_TSSOC","T_FIELD_MAXCELLTEMP","T_FIELD_TIREFL","T_FIELD_TIREFR","T_FIELD_TIRERL","T_FIELD_TIRERR","T_FIELD_LAPCOUNT","T_FIELD_INICHKSTATE","T_FIELD_ERR","T_FIELD_SDC","T_FIELD_INVRREADY","T_FIELD_INVLREADY","T_FIELD_R2DPROGRESS","T_FIELD_ACTIVEMISSION","T_FIELD_ASSTATE","T_FIELD_TSSTATE","T_NUMBERWILDCARD","T_DEFAULTWILDCARD_CENTERED","T_DEFAULTWILDCARD_RIGHTALIGNED","T_FIELD_TSCURRENT","T_FIELD_MINCELLVOLT","T_FIELD_SPEED","T_INSPECTION_HUGE","T_EBS_HUGE","T_TRACKDRIVE_HUGE","T_AUTOX_HUGE","T_SKIDPAD_HUGE","T_ACCEL_HUGE","T_INVALID_HUGE","T_MANUAL","T_INSPECTION","T_EBS","T_TRACKDRIVE","T_AUTOX","T_SKIDPAD","T_ACCEL","T___SINGLEUSE_F9I5","T___SINGLEUSE_JN2J","T___SINGLEUSE_ZP7N","T___SINGLEUSE_9L8R","T___SINGLEUSE_1NKF","T___SINGLEUSE_J5UH","T___SINGLEUSE_NGUK","T___SINGLEUSE_4E84","T___SINGLEUSE_YTAB","T___SINGLEUSE_RWCE","T___SINGLEUSE_HMH2","T___SINGLEUSE_4OBM","T___SINGLEUSE_PHFD","T___SINGLEUSE_H6UX","T___SINGLEUSE_20H3","T___SINGLEUSE_SDGP","T___SINGLEUSE_M5X7","T___SINGLEUSE_6GPV"]} \ No newline at end of file diff --git a/TouchGFX/generated/texts/cache/TextsCpp.cache b/TouchGFX/generated/texts/cache/TextsCpp.cache index 975d108..287e715 100644 --- a/TouchGFX/generated/texts/cache/TextsCpp.cache +++ b/TouchGFX/generated/texts/cache/TextsCpp.cache @@ -1 +1 @@ -{"remap":"yes","languages":["Gb"],"characters":[67,104,111,111,115,101,32,97,32,109,105,115,115,105,111,110,0,67,117,114,114,101,110,116,32,77,105,115,115,105,111,110,58,0,73,110,118,97,108,105,100,32,77,105,115,115,105,111,110,33,0,73,110,118,97,108,105,100,32,77,105,115,115,105,111,110,0,77,97,110,117,97,108,32,68,114,105,118,105,110,103,0,65,99,99,101,108,101,114,97,116,105,111,110,0,73,110,115,112,101,99,116,105,111,110,0,80,65,82,65,77,69,84,69,82,83,0,84,114,97,99,107,100,114,105,118,101,0,65,77,83,32,69,114,114,79,114,0,65,117,116,111,99,114,111,115,115,0,80,82,69,67,72,65,82,71,69,0,69,66,83,32,84,101,115,116,0,73,78,86,69,82,84,69,82,0,2,0,65,83,83,84,65,84,69,0,73,67,83,84,65,84,69,0,73,78,86,76,82,68,89,0,73,78,86,82,82,68,89,0,77,73,83,83,73,79,78,0,82,50,68,80,82,79,71,0,83,107,105,100,112,97,100,0,84,83,83,84,65,84,69,0,66,82,65,75,69,83,0,84,83,86,66,65,84,0,84,83,86,86,69,72,0,69,82,82,79,82,0,76,86,83,79,67,0,77,79,84,79,82,0,83,80,69,69,68,0,84,83,83,79,67,0,66,66,65,76,0,76,65,80,83,0,84,77,65,88,0,84,84,70,76,0,84,84,70,82,0,84,84,82,76,0,84,84,82,82,0,86,77,73,78,0,73,84,83,0,82,50,68,0,83,68,67,0,76,86,0]} \ No newline at end of file +{"remap":"yes","languages":["Gb"],"characters":[67,104,111,111,115,101,32,97,32,109,105,115,115,105,111,110,0,67,117,114,114,101,110,116,32,77,105,115,115,105,111,110,58,0,73,110,118,97,108,105,100,32,77,105,115,115,105,111,110,33,0,73,110,118,97,108,105,100,32,77,105,115,115,105,111,110,0,77,97,110,117,97,108,32,68,114,105,118,105,110,103,0,65,99,99,101,108,101,114,97,116,105,111,110,0,73,110,115,112,101,99,116,105,111,110,0,80,65,82,65,77,69,84,69,82,83,0,84,114,97,99,107,100,114,105,118,101,0,65,77,83,32,69,114,114,79,114,0,65,117,116,111,99,114,111,115,115,0,80,82,69,67,72,65,82,71,69,0,69,66,83,32,84,101,115,116,0,73,78,86,69,82,84,69,82,0,2,0,65,83,83,84,65,84,69,0,73,67,83,84,65,84,69,0,73,78,86,76,82,68,89,0,73,78,86,82,82,68,89,0,77,73,83,83,73,79,78,0,82,50,68,80,82,79,71,0,83,107,105,100,112,97,100,0,84,83,83,84,65,84,69,0,66,82,65,75,69,83,0,84,83,86,66,65,84,0,84,83,86,86,69,72,0,69,82,82,79,82,0,76,86,83,79,67,0,77,79,84,79,82,0,83,80,69,69,68,0,84,83,83,79,67,0,66,66,65,76,0,76,65,80,83,0,84,77,65,88,0,84,84,70,76,0,84,84,70,82,0,84,84,82,76,0,84,84,82,82,0,86,77,73,78,0,65,77,83,0,73,78,86,0,73,84,83,0,80,68,85,0,82,50,68,0,83,67,83,0,83,68,67,0,76,86,0]} \ No newline at end of file diff --git a/TouchGFX/generated/texts/cache/TypedTextDatabaseCpp.cache b/TouchGFX/generated/texts/cache/TypedTextDatabaseCpp.cache index f25ec18..86e4be8 100644 --- a/TouchGFX/generated/texts/cache/TypedTextDatabaseCpp.cache +++ b/TouchGFX/generated/texts/cache/TypedTextDatabaseCpp.cache @@ -1 +1 @@ -{"databases":{"GB":[[3,"CENTER","LTR"],[5,"LEFT","LTR"],[2,"CENTER","LTR"],[6,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[4,"CENTER","LTR"],[0,"CENTER","LTR"],[0,"RIGHT","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[0,"LEFT","LTR"],[3,"CENTER","LTR"],[1,"RIGHT","LTR"],[1,"LEFT","LTR"],[4,"RIGHT","LTR"],[1,"LEFT","LTR"],[1,"CENTER","LTR"],[1,"LEFT","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[4,"CENTER","LTR"],[1,"LEFT","LTR"],[2,"CENTER","LTR"],[1,"LEFT","LTR"]],"DEFAULT":[[3,"CENTER","LTR"],[5,"LEFT","LTR"],[2,"CENTER","LTR"],[6,"LEFT","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[4,"CENTER","LTR"],[0,"CENTER","LTR"],[0,"RIGHT","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[0,"LEFT","LTR"],[3,"CENTER","LTR"],[1,"RIGHT","LTR"],[1,"LEFT","LTR"],[4,"RIGHT","LTR"],[1,"LEFT","LTR"],[1,"CENTER","LTR"],[1,"LEFT","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[4,"CENTER","LTR"],[1,"LEFT","LTR"],[2,"CENTER","LTR"],[1,"LEFT","LTR"]]},"database_list":["GB"],"fonts":{"getFont_verdana_20_4bpp":0,"getFont_CHINN____30_4bpp":1,"getFont_CHINN____20_4bpp":2,"getFont_CHINN____40_4bpp":3,"getFont_lucon_TTF_50_4bpp":4,"getFont_verdanab_20_4bpp":5,"getFont_lucon_TTF_33_4bpp":6},"generate_font_format":"0"} \ No newline at end of file +{"databases":{"GB":[[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[3,"CENTER","LTR"],[5,"LEFT","LTR"],[2,"CENTER","LTR"],[6,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[4,"CENTER","LTR"],[0,"CENTER","LTR"],[0,"RIGHT","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[0,"LEFT","LTR"],[3,"CENTER","LTR"],[1,"RIGHT","LTR"],[1,"LEFT","LTR"],[4,"RIGHT","LTR"],[1,"LEFT","LTR"],[1,"CENTER","LTR"],[1,"LEFT","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[4,"CENTER","LTR"],[1,"LEFT","LTR"],[2,"CENTER","LTR"],[1,"LEFT","LTR"]],"DEFAULT":[[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[3,"CENTER","LTR"],[5,"LEFT","LTR"],[2,"CENTER","LTR"],[6,"LEFT","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[4,"CENTER","LTR"],[0,"CENTER","LTR"],[0,"RIGHT","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[3,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[0,"LEFT","LTR"],[3,"CENTER","LTR"],[1,"RIGHT","LTR"],[1,"LEFT","LTR"],[4,"RIGHT","LTR"],[1,"LEFT","LTR"],[1,"CENTER","LTR"],[1,"LEFT","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[2,"CENTER","LTR"],[4,"CENTER","LTR"],[1,"LEFT","LTR"],[2,"CENTER","LTR"],[1,"LEFT","LTR"]]},"database_list":["GB"],"fonts":{"getFont_verdana_20_4bpp":0,"getFont_CHINN____30_4bpp":1,"getFont_CHINN____20_4bpp":2,"getFont_CHINN____40_4bpp":3,"getFont_lucon_TTF_50_4bpp":4,"getFont_verdanab_20_4bpp":5,"getFont_lucon_TTF_33_4bpp":6},"generate_font_format":"0"} \ No newline at end of file diff --git a/TouchGFX/generated/texts/include/texts/TextKeysAndLanguages.hpp b/TouchGFX/generated/texts/include/texts/TextKeysAndLanguages.hpp index c3baa46..e88b85f 100644 --- a/TouchGFX/generated/texts/include/texts/TextKeysAndLanguages.hpp +++ b/TouchGFX/generated/texts/include/texts/TextKeysAndLanguages.hpp @@ -12,6 +12,13 @@ enum LANGUAGES enum TEXTS { + T_PDU, + T_SCS, + T_SDC, + T_R2D, + T_TS, + T_INV, + T_AMS, T_ERROR_AMS, T_DEBUGVIEWFIELD_TITLE, T_DRIVERVIEWFIELD_TITLE, @@ -56,6 +63,7 @@ enum TEXTS T_AUTOX, T_SKIDPAD, T_ACCEL, + T___SINGLEUSE_F9I5, T___SINGLEUSE_JN2J, T___SINGLEUSE_ZP7N, T___SINGLEUSE_9L8R, diff --git a/TouchGFX/generated/texts/src/LanguageGb.cpp b/TouchGFX/generated/texts/src/LanguageGb.cpp index aa2458e..485d95a 100644 --- a/TouchGFX/generated/texts/src/LanguageGb.cpp +++ b/TouchGFX/generated/texts/src/LanguageGb.cpp @@ -10,6 +10,13 @@ KEEP extern const uint32_t indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE; // Remap all strings TEXT_LOCATION_FLASH_PRAGMA KEEP extern const uint32_t indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE = { + 345, // T_PDU: "PDU" + 353, // T_SCS: "SCS" + 357, // T_SDC: "SDC" + 349, // T_R2D: "R2D" + 342, // T_TS: "TS" + 337, // T_INV: "INV" + 333, // T_AMS: "AMS" 128, // T_ERROR_AMS: "AMS ErrOr" 176, // T_DEBUGVIEWFIELD_TITLE: "<>" 176, // T_DRIVERVIEWFIELD_TITLE: "<>" @@ -27,7 +34,7 @@ KEEP extern const uint32_t indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE = { 298, // T_FIELD_LAPCOUNT: "LAPS" 186, // T_FIELD_INICHKSTATE: "ICSTATE" 263, // T_FIELD_ERR: "ERROR" - 341, // T_FIELD_SDC: "SDC" + 357, // T_FIELD_SDC: "SDC" 202, // T_FIELD_INVRREADY: "INVRRDY" 194, // T_FIELD_INVLREADY: "INVLRDY" 218, // T_FIELD_R2DPROGRESS: "R2DPROG" @@ -37,7 +44,7 @@ KEEP extern const uint32_t indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE = { 176, // T_NUMBERWILDCARD: "<>" 176, // T_DEFAULTWILDCARD_CENTERED: "<>" 176, // T_DEFAULTWILDCARD_RIGHTALIGNED: "<>" - 333, // T_FIELD_TSCURRENT: "ITS" + 341, // T_FIELD_TSCURRENT: "ITS" 328, // T_FIELD_MINCELLVOLT: "VMIN" 281, // T_FIELD_SPEED: "SPEED" 95, // T_INSPECTION_HUGE: "Inspection" @@ -54,18 +61,19 @@ KEEP extern const uint32_t indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE = { 138, // T_AUTOX: "Autocross" 226, // T_SKIDPAD: "Skidpad" 82, // T_ACCEL: "Acceleration" + 16, // T___SINGLEUSE_F9I5: "" 275, // T___SINGLEUSE_JN2J: "MOTOR" 167, // T___SINGLEUSE_ZP7N: "INVERTER" 176, // T___SINGLEUSE_9L8R: "<>" 16, // T___SINGLEUSE_1NKF: "" 176, // T___SINGLEUSE_J5UH: "<>" - 337, // T___SINGLEUSE_NGUK: "R2D" + 349, // T___SINGLEUSE_NGUK: "R2D" 176, // T___SINGLEUSE_4E84: "<>" 176, // T___SINGLEUSE_YTAB: "<>" 106, // T___SINGLEUSE_RWCE: "PARAMETERS" 148, // T___SINGLEUSE_HMH2: "PRECHARGE" - 345, // T___SINGLEUSE_4OBM: "LV" - 334, // T___SINGLEUSE_PHFD: "TS" + 361, // T___SINGLEUSE_4OBM: "LV" + 342, // T___SINGLEUSE_PHFD: "TS" 242, // T___SINGLEUSE_H6UX: "BRAKES" 176, // T___SINGLEUSE_20H3: "<>" 17, // T___SINGLEUSE_SDGP: "Current Mission:" diff --git a/TouchGFX/generated/texts/src/Texts.cpp b/TouchGFX/generated/texts/src/Texts.cpp index 9850d79..3104a7c 100644 --- a/TouchGFX/generated/texts/src/Texts.cpp +++ b/TouchGFX/generated/texts/src/Texts.cpp @@ -99,10 +99,14 @@ KEEP extern const touchgfx::Unicode::UnicodeChar texts_all_languages[] TEXT_LOCA 0x54, 0x54, 0x52, 0x4c, 0x0, // @318 "TTRL" 0x54, 0x54, 0x52, 0x52, 0x0, // @323 "TTRR" 0x56, 0x4d, 0x49, 0x4e, 0x0, // @328 "VMIN" - 0x49, 0x54, 0x53, 0x0, // @333 "ITS" - 0x52, 0x32, 0x44, 0x0, // @337 "R2D" - 0x53, 0x44, 0x43, 0x0, // @341 "SDC" - 0x4c, 0x56, 0x0 // @345 "LV" + 0x41, 0x4d, 0x53, 0x0, // @333 "AMS" + 0x49, 0x4e, 0x56, 0x0, // @337 "INV" + 0x49, 0x54, 0x53, 0x0, // @341 "ITS" + 0x50, 0x44, 0x55, 0x0, // @345 "PDU" + 0x52, 0x32, 0x44, 0x0, // @349 "R2D" + 0x53, 0x43, 0x53, 0x0, // @353 "SCS" + 0x53, 0x44, 0x43, 0x0, // @357 "SDC" + 0x4c, 0x56, 0x0 // @361 "LV" }; TEXT_LOCATION_FLASH_PRAGMA diff --git a/TouchGFX/generated/texts/src/TypedTextDatabase.cpp b/TouchGFX/generated/texts/src/TypedTextDatabase.cpp index 1b73629..8428552 100644 --- a/TouchGFX/generated/texts/src/TypedTextDatabase.cpp +++ b/TouchGFX/generated/texts/src/TypedTextDatabase.cpp @@ -28,6 +28,13 @@ extern const touchgfx::TypedText::TypedTextData* const typedTextDatabaseArray[]; TEXT_LOCATION_FLASH_PRAGMA const touchgfx::TypedText::TypedTextData typedText_database_GB[] TEXT_LOCATION_FLASH_ATTRIBUTE = { + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, { 3, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, { 5, touchgfx::LEFT, touchgfx::TEXT_DIRECTION_LTR }, { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, @@ -74,6 +81,7 @@ const touchgfx::TypedText::TypedTextData typedText_database_GB[] TEXT_LOCATION_F { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, { 0, touchgfx::LEFT, touchgfx::TEXT_DIRECTION_LTR }, { 3, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, { 1, touchgfx::RIGHT, touchgfx::TEXT_DIRECTION_LTR }, @@ -92,6 +100,13 @@ const touchgfx::TypedText::TypedTextData typedText_database_GB[] TEXT_LOCATION_F }; TEXT_LOCATION_FLASH_PRAGMA const touchgfx::TypedText::TypedTextData typedText_database_DEFAULT[] TEXT_LOCATION_FLASH_ATTRIBUTE = { + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, { 3, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, { 5, touchgfx::LEFT, touchgfx::TEXT_DIRECTION_LTR }, { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, @@ -138,6 +153,7 @@ const touchgfx::TypedText::TypedTextData typedText_database_DEFAULT[] TEXT_LOCAT { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, + { 2, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, { 0, touchgfx::LEFT, touchgfx::TEXT_DIRECTION_LTR }, { 3, touchgfx::CENTER, touchgfx::TEXT_DIRECTION_LTR }, { 1, touchgfx::RIGHT, touchgfx::TEXT_DIRECTION_LTR }, diff --git a/TouchGFX/gui/include/gui/containers/DriverViewStatusItem.hpp b/TouchGFX/gui/include/gui/containers/DriverViewStatusItem.hpp new file mode 100644 index 0000000..584b769 --- /dev/null +++ b/TouchGFX/gui/include/gui/containers/DriverViewStatusItem.hpp @@ -0,0 +1,37 @@ +#ifndef DRIVERVIEWSTATUSITEM_HPP +#define DRIVERVIEWSTATUSITEM_HPP + +#include "touchgfx/Color.hpp" +#include "touchgfx/hal/Types.hpp" +#include + +enum class DriverViewStatusType { TS_R2D, AMS, SDC, SCS, PDU, INV }; + +class DriverViewStatusItem : public DriverViewStatusItemBase { +public: + DriverViewStatusItem(); + virtual ~DriverViewStatusItem() {} + + virtual void initialize(); + + virtual void setType(DriverViewStatusType type); + + void update(); + + static inline colortype COLOR_OFF = + touchgfx::Color::getColorFromRGB(0x00, 0x00, 0x00); + static inline colortype COLOR_OK = + touchgfx::Color::getColorFromRGB(0x0D, 0xBF, 0x00); + static inline colortype COLOR_WARNING = + touchgfx::Color::getColorFromRGB(0xEB, 0xC4, 0x00); + static inline colortype COLOR_ERROR = + touchgfx::Color::getColorFromRGB(0xC5, 0x0E, 0x1F); + static inline colortype COLOR_TS = + touchgfx::Color::getColorFromRGB(0xEB, 0x7D, 0x00); + +protected: +private: + DriverViewStatusType type; +}; + +#endif // DRIVERVIEWSTATUSITEM_HPP diff --git a/TouchGFX/gui/include/gui/driverview_screen/DriverViewView.hpp b/TouchGFX/gui/include/gui/driverview_screen/DriverViewView.hpp index 3386b36..d3c2de1 100644 --- a/TouchGFX/gui/include/gui/driverview_screen/DriverViewView.hpp +++ b/TouchGFX/gui/include/gui/driverview_screen/DriverViewView.hpp @@ -23,6 +23,7 @@ public: void setFieldType(size_t i, DataFieldType type); void updateFieldValues(); + void updateStatusItems(); void setTemps(const Temperatures &temps); void setTSSoC(uint8_t soc); diff --git a/TouchGFX/gui/src/containers/DriverViewStatusItem.cpp b/TouchGFX/gui/src/containers/DriverViewStatusItem.cpp new file mode 100644 index 0000000..02d31e5 --- /dev/null +++ b/TouchGFX/gui/src/containers/DriverViewStatusItem.cpp @@ -0,0 +1,63 @@ +#include + +#include "texts/TextKeysAndLanguages.hpp" +#include "vehicle.h" + +DriverViewStatusItem::DriverViewStatusItem() {} + +void DriverViewStatusItem::initialize() { + DriverViewStatusItemBase::initialize(); +} + +void DriverViewStatusItem::setType(DriverViewStatusType type) { + this->type = type; +} + +void DriverViewStatusItem::update() { + switch (type) { + case DriverViewStatusType::TS_R2D: + if (vehicle_state.ts_state == TS_ERROR) { + text.setTypedText(T_TS); + bg.setColor(COLOR_ERROR); + } else if (vehicle_state.ts_state == TS_INACTIVE) { + text.setTypedText(T_TS); + bg.setColor(COLOR_OFF); + } else if (vehicle_state.r2d_progress == R2D_INIT_SUCCESS) { + text.setTypedText(T_R2D); + bg.setColor(COLOR_OK); + } else { + text.setTypedText(T_TS); + bg.setColor(COLOR_TS); + } + break; + case DriverViewStatusType::AMS: + text.setTypedText(T_AMS); + bg.setColor(vehicle_state.ts_state == TS_ERROR ? COLOR_ERROR : COLOR_OK); + break; + case DriverViewStatusType::SDC: + text.setTypedText(T_SDC); + bg.setColor(vehicle_state.sdc_closed ? COLOR_OK : COLOR_WARNING); + break; + case DriverViewStatusType::SCS: + text.setTypedText(T_SCS); + bg.setColor(vehicle_state.errors.err_scs ? COLOR_ERROR : COLOR_OK); + break; + case DriverViewStatusType::PDU: + text.setTypedText(T_PDU); + bg.setColor(vehicle_state.errors.err_pdu ? COLOR_ERROR : COLOR_OK); + break; + case DriverViewStatusType::INV: + text.setTypedText(T_INV); + if (vehicle_state.errors.err_invl || vehicle_state.errors.err_invr) { + bg.setColor(COLOR_ERROR); + } else if (vehicle_state.errors.invl_ready && + vehicle_state.errors.invr_ready) { + bg.setColor(COLOR_OK); + } else { + bg.setColor(COLOR_OFF); + } + break; + } + text.invalidate(); + bg.invalidate(); +} diff --git a/TouchGFX/gui/src/driverview_screen/DriverViewPresenter.cpp b/TouchGFX/gui/src/driverview_screen/DriverViewPresenter.cpp index 3454ea0..3825794 100644 --- a/TouchGFX/gui/src/driverview_screen/DriverViewPresenter.cpp +++ b/TouchGFX/gui/src/driverview_screen/DriverViewPresenter.cpp @@ -22,6 +22,7 @@ void DriverViewPresenter::vehicleStateUpdated() { updateErrorPopup(); view.updateFieldValues(); + view.updateStatusItems(); } void DriverViewPresenter::nextScreen() { diff --git a/TouchGFX/gui/src/driverview_screen/DriverViewView.cpp b/TouchGFX/gui/src/driverview_screen/DriverViewView.cpp index d5ba9ed..711d1ab 100644 --- a/TouchGFX/gui/src/driverview_screen/DriverViewView.cpp +++ b/TouchGFX/gui/src/driverview_screen/DriverViewView.cpp @@ -1,7 +1,10 @@ #include "gui/common/NamedField.hpp" #include "gui/containers/DriverViewField.hpp" +#include "gui/containers/DriverViewStatusItem.hpp" #include "gui/driverview_screen/DriverViewPresenter.hpp" #include "texts/TextKeysAndLanguages.hpp" +#include "touchgfx/Callback.hpp" +#include "touchgfx/Drawable.hpp" #include "touchgfx/Unicode.hpp" #include "vehicle.h" #include @@ -16,6 +19,12 @@ void DriverViewView::setupScreen() { for (size_t i = 0; i < NUM_FIELDS; i++) { getField(i).setType(fieldTypes[i]); } + statusTS_R2D.setType(DriverViewStatusType::TS_R2D); + statusAMS.setType(DriverViewStatusType::AMS); + statusSDC.setType(DriverViewStatusType::SDC); + statusSCS.setType(DriverViewStatusType::SCS); + statusPDU.setType(DriverViewStatusType::PDU); + statusINV.setType(DriverViewStatusType::INV); fieldTypeSelection.setNumberOfItems(DataFieldType_COUNT); // int tireThresholds[4] = {35, 40, 50, 60}; // tireTempFL.setTempThresholds(tireThresholds); @@ -57,6 +66,22 @@ void DriverViewView::updateFieldValues() { } } +class StatusItemUpdateCallback + : public touchgfx::GenericCallback { + virtual void execute(Drawable &item) override { + DriverViewStatusItem &statusItem = + static_cast(item); + statusItem.update(); + } + + virtual bool isValid() const override { return true; } +}; + +void DriverViewView::updateStatusItems() { + StatusItemUpdateCallback cb; + statusItems.forEachChild(&cb); +} + void DriverViewView::setTemps(const Temperatures &temps) { brakeTempFL.setTemp(roundf(temps.brake_fl)); brakeTempFR.setTemp(roundf(temps.brake_fr)); diff --git a/TouchGFX/simulator/msvs/Application.vcxproj b/TouchGFX/simulator/msvs/Application.vcxproj index 3e55de4..5f9ebd2 100644 --- a/TouchGFX/simulator/msvs/Application.vcxproj +++ b/TouchGFX/simulator/msvs/Application.vcxproj @@ -53,6 +53,8 @@ + + @@ -235,6 +237,8 @@ + + diff --git a/TouchGFX/simulator/msvs/Application.vcxproj.filters b/TouchGFX/simulator/msvs/Application.vcxproj.filters index a98a4e8..fc1ff3b 100644 --- a/TouchGFX/simulator/msvs/Application.vcxproj.filters +++ b/TouchGFX/simulator/msvs/Application.vcxproj.filters @@ -372,6 +372,12 @@ Source Files\generated\gui_generated\containers + + Source Files\gui\containers + + + Source Files\generated\gui_generated\containers + @@ -910,6 +916,12 @@ Header Files\generated\gui_generated\containers + + Header Files\gui\containers + + + Header Files\generated\gui_generated\containers + diff --git a/TouchGFX/steering-wheel.touchgfx b/TouchGFX/steering-wheel.touchgfx index 03264ed..7524b6a 100644 --- a/TouchGFX/steering-wheel.touchgfx +++ b/TouchGFX/steering-wheel.touchgfx @@ -314,16 +314,6 @@ "Blue": 255 } }, - { - "Type": "CustomContainerInstance", - "Name": "errorPopup", - "X": 15, - "Y": 155, - "Width": 450, - "Height": 150, - "Visible": false, - "CustomContainerDefinitionName": "ErrorPopup" - }, { "Type": "Container", "Name": "drivetrainTemps", @@ -577,6 +567,62 @@ "Width": 450, "Height": 33, "Components": [ + { + "Type": "ListLayout", + "Name": "statusItems", + "Width": 450, + "Height": 33, + "Direction": "East", + "Components": [ + { + "Type": "CustomContainerInstance", + "Name": "statusTS_R2D", + "Width": 75, + "Height": 33, + "CustomContainerDefinitionName": "DriverViewStatusItem" + }, + { + "Type": "CustomContainerInstance", + "Name": "statusAMS", + "X": 75, + "Width": 75, + "Height": 33, + "CustomContainerDefinitionName": "DriverViewStatusItem" + }, + { + "Type": "CustomContainerInstance", + "Name": "statusSDC", + "X": 150, + "Width": 75, + "Height": 33, + "CustomContainerDefinitionName": "DriverViewStatusItem" + }, + { + "Type": "CustomContainerInstance", + "Name": "statusSCS", + "X": 225, + "Width": 75, + "Height": 33, + "CustomContainerDefinitionName": "DriverViewStatusItem" + }, + { + "Type": "CustomContainerInstance", + "Name": "statusPDU", + "X": 300, + "Width": 75, + "Height": 33, + "CustomContainerDefinitionName": "DriverViewStatusItem" + }, + { + "Type": "CustomContainerInstance", + "Name": "statusINV", + "X": 375, + "Width": 75, + "Height": 33, + "CustomContainerDefinitionName": "DriverViewStatusItem" + } + ] + }, { "Type": "BoxProgress", "Name": "progressBar", @@ -644,6 +690,16 @@ "Wildcard1": {} } ] + }, + { + "Type": "CustomContainerInstance", + "Name": "errorPopup", + "X": 15, + "Y": 155, + "Width": 450, + "Height": 150, + "Visible": false, + "CustomContainerDefinitionName": "ErrorPopup" } ], "Interactions": [ @@ -1325,6 +1381,42 @@ } ], "Interactions": [] + }, + { + "Name": "DriverViewStatusItem", + "X": 35, + "Y": 115, + "Width": 75, + "Height": 33, + "Components": [ + { + "Type": "BoxWithBorder", + "Name": "bg", + "Width": 75, + "Height": 33, + "BorderColor": { + "Red": 255, + "Green": 255, + "Blue": 255 + }, + "BorderSize": 1 + }, + { + "Type": "TextArea", + "Name": "text", + "Y": 4, + "Width": 75, + "Height": 25, + "TextId": "__SingleUse_F9I5", + "TextRotation": "0", + "Color": { + "Red": 255, + "Green": 255, + "Blue": 255 + } + } + ], + "Interactions": [] } ], "Name": "SteeringWheel",