Add screen for configuring vehicle parameters

This commit is contained in:
2023-04-04 20:58:34 +02:00
parent 09f65fcf22
commit a5f10be4fd
35 changed files with 1976 additions and 104 deletions

View File

@ -17,6 +17,8 @@
#include <gui/driverview_screen/DriverViewPresenter.hpp>
#include <gui/debugview_screen/DebugViewView.hpp>
#include <gui/debugview_screen/DebugViewPresenter.hpp>
#include <gui/vehicleconfig_screen/VehicleConfigView.hpp>
#include <gui/vehicleconfig_screen/VehicleConfigPresenter.hpp>
using namespace touchgfx;
@ -86,3 +88,16 @@ void FrontendApplicationBase::gotoDebugViewScreenNoTransitionImpl()
{
touchgfx::makeTransition<DebugViewView, DebugViewPresenter, touchgfx::NoTransition, Model >(&currentScreen, &currentPresenter, frontendHeap, &currentTransition, &model);
}
// VehicleConfig
void FrontendApplicationBase::gotoVehicleConfigScreenNoTransition()
{
transitionCallback = touchgfx::Callback<FrontendApplicationBase>(this, &FrontendApplication::gotoVehicleConfigScreenNoTransitionImpl);
pendingScreenTransitionCallback = &transitionCallback;
}
void FrontendApplicationBase::gotoVehicleConfigScreenNoTransitionImpl()
{
touchgfx::makeTransition<VehicleConfigView, VehicleConfigPresenter, touchgfx::NoTransition, Model >(&currentScreen, &currentPresenter, frontendHeap, &currentTransition, &model);
}

View File

@ -0,0 +1,55 @@
/*********************************************************************************/
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
/*********************************************************************************/
#include <gui_generated/containers/ConfigItemBase.hpp>
#include <touchgfx/Color.hpp>
#include <texts/TextKeysAndLanguages.hpp>
ConfigItemBase::ConfigItemBase()
{
setWidth(450);
setHeight(50);
bg.setPosition(0, 0, 450, 50);
bg.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
add(bg);
title.setPosition(0, 6, 200, 37);
title.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
title.setLinespacing(0);
title.setTypedText(touchgfx::TypedText(T___SINGLEUSE_YTAB));
add(title);
line1.setPosition(200, 0, 2, 50);
line1Painter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
line1.setPainter(line1Painter);
line1.setStart(0, 0);
line1.setEnd(0, 50);
line1.setLineWidth(10);
line1.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
add(line1);
value.setPosition(207, -7, 243, 55);
value.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
value.setLinespacing(0);
value.setTypedText(touchgfx::TypedText(T___SINGLEUSE_4E84));
add(value);
line2.setPosition(0, 48, 450, 2);
line2Painter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
line2.setPainter(line2Painter);
line2.setStart(0, 0);
line2.setEnd(450, 0);
line2.setLineWidth(10);
line2.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
add(line2);
}
ConfigItemBase::~ConfigItemBase()
{
}
void ConfigItemBase::initialize()
{
}

View File

@ -126,4 +126,13 @@ void MissionSelectViewBase::handleKeyEvent(uint8_t key)
application().gotoDebugViewScreenNoTransition();
}
if(251 == key)
{
//DummyChangeConfigView
//When hardware button 251 clicked change screen to VehicleConfig
//Go to VehicleConfig with no screen transition
application().gotoVehicleConfigScreenNoTransition();
}
}

View File

@ -0,0 +1,117 @@
/*********************************************************************************/
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
/*********************************************************************************/
#include <gui_generated/vehicleconfig_screen/VehicleConfigViewBase.hpp>
#include <touchgfx/canvas_widget_renderer/CanvasWidgetRenderer.hpp>
#include <touchgfx/Color.hpp>
#include <texts/TextKeysAndLanguages.hpp>
VehicleConfigViewBase::VehicleConfigViewBase() :
updateItemCallback(this, &VehicleConfigViewBase::updateItemCallbackHandler)
{
touchgfx::CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);
__background.setPosition(0, 0, 480, 320);
__background.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
add(__background);
title.setPosition(15, 15, 450, 37);
title.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
title.setLinespacing(0);
title.setTypedText(touchgfx::TypedText(T___SINGLEUSE_RWCE));
add(title);
params.setPosition(15, 60, 450, 245);
params.setHorizontal(false);
params.setCircular(false);
params.setEasingEquation(touchgfx::EasingEquations::cubicEaseOut);
params.setSwipeAcceleration(10);
params.setDragAcceleration(10);
params.setNumberOfItems(1);
params.setSelectedItemOffset(0);
params.setDrawableSize(50, 0);
params.setDrawables(paramsListItems, updateItemCallback);
params.animateToItem(0, 0);
add(params);
line1.setPosition(15, 58, 450, 2);
line1Painter.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
line1.setPainter(line1Painter);
line1.setStart(0, 0);
line1.setEnd(450, 0);
line1.setLineWidth(10);
line1.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
add(line1);
}
VehicleConfigViewBase::~VehicleConfigViewBase()
{
touchgfx::CanvasWidgetRenderer::resetBuffer();
}
void VehicleConfigViewBase::setupScreen()
{
params.initialize();
for (int i = 0; i < paramsListItems.getNumberOfDrawables(); i++)
{
paramsListItems[i].initialize();
}
}
void VehicleConfigViewBase::handleKeyEvent(uint8_t key)
{
if(22 == key)
{
//SelectPreviousParam
//When hardware button 22 clicked call virtual function
//Call selectPrevParam
selectPrevParam();
}
if(21 == key)
{
//SelectNextParam
//When hardware button 21 clicked call virtual function
//Call selectNextParam
selectNextParam();
}
if(24 == key)
{
//DecreaseParam
//When hardware button 24 clicked call virtual function
//Call decParam
decParam();
}
if(23 == key)
{
//IncreaseParam
//When hardware button 23 clicked call virtual function
//Call incParam
incParam();
}
if(6 == key)
{
//ConfirmParam
//When hardware button 6 clicked call virtual function
//Call confirmParam
confirmParam();
}
}
void VehicleConfigViewBase::updateItemCallbackHandler(touchgfx::DrawableListItemsInterface* items, int16_t containerIndex, int16_t itemIndex)
{
if (items == &paramsListItems)
{
touchgfx::Drawable* d = items->getDrawable(containerIndex);
ConfigItem* cc = (ConfigItem*)d;
paramsUpdateItem(*cc, itemIndex);
}
}