316 lines
10 KiB
C++
316 lines
10 KiB
C++
/*********************************************************************************/
|
|
/********** 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>
|
|
#include <texts/TextKeysAndLanguages.hpp>
|
|
|
|
DriverViewViewBase::DriverViewViewBase() :
|
|
updateItemCallback(this, &DriverViewViewBase::updateItemCallbackHandler)
|
|
{
|
|
touchgfx::CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);
|
|
|
|
__background.setPosition(0, 0, 480, 320);
|
|
__background.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
|
|
add(__background);
|
|
|
|
tsSoC.setXY(15, 155);
|
|
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(110, 155);
|
|
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);
|
|
|
|
tsSoCLabel.setPosition(15, 130, 40, 25);
|
|
tsSoCLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
|
tsSoCLabel.setLinespacing(0);
|
|
tsSoCLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_PHFD));
|
|
add(tsSoCLabel);
|
|
|
|
lvSoCLabel.setPosition(110, 130, 40, 25);
|
|
lvSoCLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
|
lvSoCLabel.setLinespacing(0);
|
|
lvSoCLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_4OBM));
|
|
add(lvSoCLabel);
|
|
|
|
drivetrainTemps.setPosition(315, 130, 150, 175);
|
|
motorTempLabel.setPosition(0, 90, 150, 25);
|
|
motorTempLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
|
motorTempLabel.setLinespacing(0);
|
|
motorTempLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_JN2J));
|
|
drivetrainTemps.add(motorTempLabel);
|
|
|
|
motorTempL.setXY(14, 115);
|
|
drivetrainTemps.add(motorTempL);
|
|
|
|
motorTempR.setXY(77, 115);
|
|
drivetrainTemps.add(motorTempR);
|
|
|
|
motorTempDiv.setPosition(74, 115, 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);
|
|
drivetrainTemps.add(motorTempDiv);
|
|
|
|
invTempDiv.setPosition(74, 25, 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);
|
|
drivetrainTemps.add(invTempDiv);
|
|
|
|
invTempR.setXY(77, 25);
|
|
drivetrainTemps.add(invTempR);
|
|
|
|
invTempL.setXY(14, 25);
|
|
drivetrainTemps.add(invTempL);
|
|
|
|
invTempLabel.setPosition(0, 0, 150, 25);
|
|
invTempLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
|
invTempLabel.setLinespacing(0);
|
|
invTempLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_ZP7N));
|
|
drivetrainTemps.add(invTempLabel);
|
|
|
|
add(drivetrainTemps);
|
|
|
|
brakeTemps.setPosition(165, 130, 150, 150);
|
|
btDivVert.setPosition(74, 25, 3, 123);
|
|
btDivVertPainter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
|
btDivVert.setPainter(btDivVertPainter);
|
|
btDivVert.setStart(0, 0);
|
|
btDivVert.setEnd(0, 320);
|
|
btDivVert.setLineWidth(10);
|
|
btDivVert.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
|
|
brakeTemps.add(btDivVert);
|
|
|
|
btDivHoriz.setPosition(14, 85, 123, 3);
|
|
btDivHorizPainter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
|
btDivHoriz.setPainter(btDivHorizPainter);
|
|
btDivHoriz.setStart(0, 0);
|
|
btDivHoriz.setEnd(480, 0);
|
|
btDivHoriz.setLineWidth(10);
|
|
btDivHoriz.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
|
|
brakeTemps.add(btDivHoriz);
|
|
|
|
brakeTempRR.setXY(77, 88);
|
|
brakeTemps.add(brakeTempRR);
|
|
|
|
brakeTempFR.setXY(77, 25);
|
|
brakeTemps.add(brakeTempFR);
|
|
|
|
brakeTempRL.setXY(14, 88);
|
|
brakeTemps.add(brakeTempRL);
|
|
|
|
brakeTempFL.setXY(14, 25);
|
|
brakeTemps.add(brakeTempFL);
|
|
|
|
brakeLabel.setPosition(0, 0, 150, 25);
|
|
brakeLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
|
brakeLabel.setLinespacing(0);
|
|
brakeLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_H6UX));
|
|
brakeTemps.add(brakeLabel);
|
|
|
|
add(brakeTemps);
|
|
|
|
dataFields.setPosition(15, 48, 450, 257);
|
|
fieldTypeSelection.setPosition(0, 80, 150, 177);
|
|
fieldTypeSelection.setHorizontal(false);
|
|
fieldTypeSelection.setCircular(true);
|
|
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);
|
|
dataFields.add(fieldTypeSelection);
|
|
|
|
field3.setXY(300, 0);
|
|
dataFields.add(field3);
|
|
|
|
field2.setXY(150, 0);
|
|
dataFields.add(field2);
|
|
|
|
field1.setXY(0, 0);
|
|
dataFields.add(field1);
|
|
|
|
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);
|
|
progressBar.setDirection(touchgfx::AbstractDirectionProgress::RIGHT);
|
|
progressBar.setBackground(touchgfx::Bitmap(BITMAP_PROG_HORIZ_BG_ID));
|
|
progressBar.setColor(touchgfx::Color::getColorFromRGB(99, 186, 0));
|
|
progressBar.setValue(0);
|
|
progressBar.setVisible(false);
|
|
statusBar.add(progressBar);
|
|
|
|
prechargeLabel.setXY(90, -2);
|
|
prechargeLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
|
prechargeLabel.setLinespacing(0);
|
|
prechargeLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_HMH2));
|
|
prechargeLabel.setVisible(false);
|
|
statusBar.add(prechargeLabel);
|
|
|
|
r2dLabel.setPosition(67, -2, 317, 37);
|
|
r2dLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
|
r2dLabel.setLinespacing(0);
|
|
r2dLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_NGUK));
|
|
r2dLabel.setVisible(false);
|
|
statusBar.add(r2dLabel);
|
|
|
|
r2dProgressLabel.setPosition(165, -2, 219, 37);
|
|
r2dProgressLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
|
|
r2dProgressLabel.setLinespacing(0);
|
|
r2dProgressLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_J5UH));
|
|
r2dProgressLabel.setVisible(false);
|
|
statusBar.add(r2dProgressLabel);
|
|
|
|
add(statusBar);
|
|
|
|
errorPopup.setXY(15, 155);
|
|
errorPopup.setVisible(false);
|
|
add(errorPopup);
|
|
}
|
|
|
|
DriverViewViewBase::~DriverViewViewBase()
|
|
{
|
|
touchgfx::CanvasWidgetRenderer::resetBuffer();
|
|
}
|
|
|
|
void DriverViewViewBase::setupScreen()
|
|
{
|
|
motorTempL.initialize();
|
|
motorTempR.initialize();
|
|
invTempR.initialize();
|
|
invTempL.initialize();
|
|
brakeTempRR.initialize();
|
|
brakeTempFR.initialize();
|
|
brakeTempRL.initialize();
|
|
brakeTempFL.initialize();
|
|
fieldTypeSelection.initialize();
|
|
for (int i = 0; i < fieldTypeSelectionListItems.getNumberOfDrawables(); i++)
|
|
{
|
|
fieldTypeSelectionListItems[i].initialize();
|
|
}
|
|
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)
|
|
{
|
|
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);
|
|
}
|
|
}
|