277 lines
8.9 KiB
C++
Raw Normal View History

2023-03-15 18:43:38 +01:00
/*********************************************************************************/
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
/*********************************************************************************/
#include <gui_generated/driverview_screen/DriverViewViewBase.hpp>
#include <touchgfx/canvas_widget_renderer/CanvasWidgetRenderer.hpp>
#include <touchgfx/Color.hpp>
#include <texts/TextKeysAndLanguages.hpp>
2023-05-05 14:50:10 +02:00
#include <images/BitmapDatabase.hpp>
2023-03-15 18:43:38 +01:00
DriverViewViewBase::DriverViewViewBase() :
updateItemCallback(this, &DriverViewViewBase::updateItemCallbackHandler)
2023-03-15 18:43:38 +01:00
{
touchgfx::CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);
__background.setPosition(0, 0, 480, 320);
__background.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
add(__background);
2023-05-05 14:50:10 +02:00
motorTempLabel.setPosition(315, 187, 150, 25);
motorTempLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
motorTempLabel.setLinespacing(0);
motorTempLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_JN2J));
add(motorTempLabel);
motorTempL.setXY(329, 212);
add(motorTempL);
motorTempR.setXY(392, 212);
add(motorTempR);
motorTempDiv.setPosition(389, 212, 3, 60);
motorTempDivPainter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
motorTempDiv.setPainter(motorTempDivPainter);
motorTempDiv.setStart(0, 0);
motorTempDiv.setEnd(0, 320);
motorTempDiv.setLineWidth(10);
motorTempDiv.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
add(motorTempDiv);
invTempDiv.setPosition(389, 122, 3, 60);
invTempDivPainter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
invTempDiv.setPainter(invTempDivPainter);
invTempDiv.setStart(0, 0);
invTempDiv.setEnd(0, 320);
invTempDiv.setLineWidth(10);
invTempDiv.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
add(invTempDiv);
invTempR.setXY(392, 122);
add(invTempR);
invTempL.setXY(329, 122);
add(invTempL);
invTempLabel.setPosition(315, 97, 150, 25);
invTempLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
invTempLabel.setLinespacing(0);
invTempLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_ZP7N));
add(invTempLabel);
ttDivVert.setPosition(239, 122, 3, 123);
2023-03-15 18:43:38 +01:00
ttDivVertPainter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
ttDivVert.setPainter(ttDivVertPainter);
ttDivVert.setStart(0, 0);
ttDivVert.setEnd(0, 320);
ttDivVert.setLineWidth(10);
ttDivVert.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
add(ttDivVert);
2023-05-05 14:50:10 +02:00
ttDivHoriz.setPosition(179, 182, 123, 3);
2023-03-15 18:43:38 +01:00
ttDivHorizPainter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
ttDivHoriz.setPainter(ttDivHorizPainter);
ttDivHoriz.setStart(0, 0);
ttDivHoriz.setEnd(480, 0);
ttDivHoriz.setLineWidth(10);
ttDivHoriz.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
add(ttDivHoriz);
2023-05-05 14:50:10 +02:00
tireTempRR.setXY(242, 185);
add(tireTempRR);
tireTempFR.setXY(242, 122);
add(tireTempFR);
tireTempRL.setXY(179, 185);
add(tireTempRL);
tireTempFL.setXY(179, 122);
add(tireTempFL);
2023-04-04 17:22:41 +02:00
tsSoC.setXY(15, 122);
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);
2023-05-05 14:50:10 +02:00
lvSoC.setXY(110, 122);
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);
2023-04-04 17:22:41 +02:00
tireLabel.setPosition(165, 97, 150, 25);
tireLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
tireLabel.setLinespacing(0);
tireLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_H6UX));
add(tireLabel);
2023-04-04 17:22:41 +02:00
tsSoCLabel.setPosition(15, 97, 40, 25);
tsSoCLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
tsSoCLabel.setLinespacing(0);
tsSoCLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_PHFD));
add(tsSoCLabel);
2023-05-05 14:50:10 +02:00
lvSoCLabel.setPosition(110, 97, 40, 25);
lvSoCLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
lvSoCLabel.setLinespacing(0);
lvSoCLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_4OBM));
add(lvSoCLabel);
2023-04-04 17:22:41 +02:00
field1.setXY(15, 15);
add(field1);
2023-04-04 17:22:41 +02:00
field2.setXY(165, 15);
add(field2);
2023-04-04 17:22:41 +02:00
field3.setXY(315, 15);
add(field3);
2023-04-04 17:22:41 +02:00
fieldTypeSelection.setPosition(15, 95, 150, 225);
fieldTypeSelection.setHorizontal(false);
fieldTypeSelection.setCircular(true);
2023-04-12 16:04:20 +02:00
fieldTypeSelection.setEasingEquation(touchgfx::EasingEquations::linearEaseOut);
fieldTypeSelection.setSwipeAcceleration(10);
fieldTypeSelection.setDragAcceleration(10);
fieldTypeSelection.setNumberOfItems(1);
fieldTypeSelection.setSelectedItemOffset(94);
fieldTypeSelection.setDrawableSize(26, 0);
fieldTypeSelection.setDrawables(fieldTypeSelectionListItems, updateItemCallback);
fieldTypeSelection.animateToItem(0, 0);
fieldTypeSelection.setVisible(false);
add(fieldTypeSelection);
2023-03-21 19:05:54 +01:00
2023-04-26 13:08:34 +02:00
progressBar.setXY(15, 280);
progressBar.setProgressIndicatorPosition(0, 0, 480, 55);
progressBar.setRange(0, 100);
progressBar.setDirection(touchgfx::AbstractDirectionProgress::RIGHT);
progressBar.setBackground(touchgfx::Bitmap(BITMAP_PRECHARGE_BG_ID));
progressBar.setColor(touchgfx::Color::getColorFromRGB(99, 186, 0));
progressBar.setValue(0);
progressBar.setVisible(false);
add(progressBar);
2023-03-21 19:05:54 +01:00
2023-04-04 17:22:41 +02:00
prechargeLabel.setXY(105, 275);
2023-03-21 19:05:54 +01:00
prechargeLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
prechargeLabel.setLinespacing(0);
prechargeLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_HMH2));
prechargeLabel.setVisible(false);
add(prechargeLabel);
2023-04-26 13:08:34 +02:00
2023-04-29 23:37:53 +02:00
r2dLabel.setPosition(82, 275, 317, 37);
2023-04-26 13:08:34 +02:00
r2dLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
r2dLabel.setLinespacing(0);
r2dLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_NGUK));
r2dLabel.setVisible(false);
add(r2dLabel);
2023-04-29 23:37:53 +02:00
r2dProgressLabel.setPosition(180, 275, 219, 37);
r2dProgressLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
r2dProgressLabel.setLinespacing(0);
r2dProgressLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_J5UH));
r2dProgressLabel.setVisible(false);
add(r2dProgressLabel);
2023-05-05 14:00:00 +02:00
errorPopup.setXY(15, 122);
errorPopup.setVisible(false);
add(errorPopup);
2023-03-15 18:43:38 +01:00
}
DriverViewViewBase::~DriverViewViewBase()
{
touchgfx::CanvasWidgetRenderer::resetBuffer();
}
void DriverViewViewBase::setupScreen()
{
2023-05-05 14:50:10 +02:00
motorTempL.initialize();
motorTempR.initialize();
invTempR.initialize();
invTempL.initialize();
2023-03-15 18:43:38 +01:00
tireTempRR.initialize();
tireTempFR.initialize();
tireTempRL.initialize();
tireTempFL.initialize();
field1.initialize();
field2.initialize();
field3.initialize();
fieldTypeSelection.initialize();
for (int i = 0; i < fieldTypeSelectionListItems.getNumberOfDrawables(); i++)
{
fieldTypeSelectionListItems[i].initialize();
}
2023-05-05 14:00:00 +02:00
errorPopup.initialize();
}
void DriverViewViewBase::handleKeyEvent(uint8_t key)
{
if(22 == key)
{
//SelectPreviousField
//When hardware button 22 clicked call virtual function
//Call selectPrevField
selectPrevField();
}
if(21 == key)
{
//SelectNextField
//When hardware button 21 clicked call virtual function
//Call selectNextField
selectNextField();
}
if(24 == key)
{
//SelectPreviousFieldType
//When hardware button 24 clicked call virtual function
//Call selectPrevFieldType
selectPrevFieldType();
}
if(23 == key)
{
//SelectNextFieldType
//When hardware button 23 clicked call virtual function
//Call selectNextFieldType
selectNextFieldType();
}
if(6 == key)
{
//ConfirmFieldType
//When hardware button 6 clicked call virtual function
//Call confirmFieldType
confirmFieldType();
}
}
void DriverViewViewBase::updateItemCallbackHandler(touchgfx::DrawableListItemsInterface* items, int16_t containerIndex, int16_t itemIndex)
{
if (items == &fieldTypeSelectionListItems)
{
touchgfx::Drawable* d = items->getDrawable(containerIndex);
DriverViewFieldSelection* cc = (DriverViewFieldSelection*)d;
fieldTypeSelectionUpdateItem(*cc, itemIndex);
}
2023-03-15 18:43:38 +01:00
}