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 <images/BitmapDatabase.hpp>
|
2023-03-18 22:51:13 +01:00
|
|
|
#include <texts/TextKeysAndLanguages.hpp>
|
2023-03-15 18:43:38 +01:00
|
|
|
|
2023-03-20 23:31:28 +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-03-21 19:05:54 +01:00
|
|
|
logo.setXY(160, 265);
|
2023-03-15 18:43:38 +01:00
|
|
|
logo.setBitmap(touchgfx::Bitmap(BITMAP_FASTTUBE_LOGO_SMALL_WHITE_ID));
|
|
|
|
add(logo);
|
|
|
|
|
2023-03-18 22:51:13 +01:00
|
|
|
tireTempRR.setXY(240, 182);
|
2023-03-15 18:43:38 +01:00
|
|
|
add(tireTempRR);
|
|
|
|
|
2023-03-18 22:51:13 +01:00
|
|
|
tireTempFR.setXY(240, 107);
|
2023-03-15 18:43:38 +01:00
|
|
|
add(tireTempFR);
|
|
|
|
|
2023-03-18 22:51:13 +01:00
|
|
|
tireTempRL.setXY(165, 182);
|
2023-03-15 18:43:38 +01:00
|
|
|
add(tireTempRL);
|
|
|
|
|
2023-03-18 22:51:13 +01:00
|
|
|
tireTempFL.setXY(165, 107);
|
2023-03-15 18:43:38 +01:00
|
|
|
add(tireTempFL);
|
|
|
|
|
2023-03-18 22:51:13 +01:00
|
|
|
ttDivVert.setPosition(239, 107, 3, 150);
|
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-03-18 22:51:13 +01:00
|
|
|
ttDivHoriz.setPosition(165, 181, 150, 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-03-18 23:06:27 +01:00
|
|
|
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);
|
|
|
|
|
|
|
|
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);
|
2023-03-18 22:51:13 +01:00
|
|
|
|
|
|
|
tireLabel.setPosition(165, 82, 150, 25);
|
|
|
|
tireLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
|
|
|
tireLabel.setLinespacing(0);
|
|
|
|
tireLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_H6UX));
|
|
|
|
add(tireLabel);
|
|
|
|
|
2023-03-18 23:06:27 +01:00
|
|
|
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);
|
|
|
|
|
|
|
|
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);
|
2023-03-18 22:51:13 +01:00
|
|
|
|
|
|
|
field1.setXY(0, 0);
|
|
|
|
add(field1);
|
|
|
|
|
|
|
|
field2.setXY(160, 0);
|
|
|
|
add(field2);
|
|
|
|
|
|
|
|
field3.setXY(320, 0);
|
|
|
|
add(field3);
|
2023-03-20 23:31:28 +01:00
|
|
|
|
|
|
|
fieldTypeSelection.setPosition(0, 80, 160, 240);
|
|
|
|
fieldTypeSelection.setHorizontal(false);
|
|
|
|
fieldTypeSelection.setCircular(true);
|
|
|
|
fieldTypeSelection.setEasingEquation(touchgfx::EasingEquations::backEaseOut);
|
|
|
|
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
|
|
|
|
|
|
|
prechargeProgress.setXY(0, 265);
|
|
|
|
prechargeProgress.setProgressIndicatorPosition(0, 0, 480, 55);
|
|
|
|
prechargeProgress.setRange(0, 100);
|
|
|
|
prechargeProgress.setDirection(touchgfx::AbstractDirectionProgress::RIGHT);
|
|
|
|
prechargeProgress.setBackground(touchgfx::Bitmap(BITMAP_PRECHARGE_BG_ID));
|
2023-03-24 21:12:03 +01:00
|
|
|
prechargeProgress.setColor(touchgfx::Color::getColorFromRGB(99, 186, 0));
|
2023-03-21 19:05:54 +01:00
|
|
|
prechargeProgress.setValue(0);
|
|
|
|
prechargeProgress.setVisible(false);
|
|
|
|
add(prechargeProgress);
|
|
|
|
|
|
|
|
prechargeLabel.setXY(105, 274);
|
|
|
|
prechargeLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
|
|
|
prechargeLabel.setLinespacing(0);
|
|
|
|
prechargeLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_HMH2));
|
|
|
|
prechargeLabel.setVisible(false);
|
|
|
|
add(prechargeLabel);
|
2023-03-15 18:43:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
DriverViewViewBase::~DriverViewViewBase()
|
|
|
|
{
|
|
|
|
touchgfx::CanvasWidgetRenderer::resetBuffer();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DriverViewViewBase::setupScreen()
|
|
|
|
{
|
|
|
|
tireTempRR.initialize();
|
|
|
|
tireTempFR.initialize();
|
|
|
|
tireTempRL.initialize();
|
|
|
|
tireTempFL.initialize();
|
2023-03-18 22:51:13 +01:00
|
|
|
field1.initialize();
|
|
|
|
field2.initialize();
|
|
|
|
field3.initialize();
|
2023-03-20 23:31:28 +01:00
|
|
|
fieldTypeSelection.initialize();
|
|
|
|
for (int i = 0; i < fieldTypeSelectionListItems.getNumberOfDrawables(); i++)
|
|
|
|
{
|
|
|
|
fieldTypeSelectionListItems[i].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
|
|
|
}
|