APPS calibration screen

This commit is contained in:
2024-12-21 16:19:44 +01:00
parent afd4688c97
commit 738e15e963
26 changed files with 1460 additions and 262 deletions

View File

@ -0,0 +1,40 @@
#ifndef APPSPRESENTER_HPP
#define APPSPRESENTER_HPP
#include <gui/model/ModelListener.hpp>
#include <mvp/Presenter.hpp>
using namespace touchgfx;
class APPSView;
class APPSPresenter : public touchgfx::Presenter, public ModelListener {
public:
APPSPresenter(APPSView &v);
/**
* The activate function is called automatically when this screen is "switched
* in" (ie. made active). Initialization logic can be placed here.
*/
virtual void activate() override;
/**
* The deactivate function is called automatically when this screen is
* "switched out" (ie. made inactive). Teardown functionality can be placed
* here.
*/
virtual void deactivate() override;
virtual ~APPSPresenter() {}
void nextScreen() override;
void vehicleStateUpdated() override;
void paramConfirmed() override;
private:
APPSPresenter();
APPSView &view;
};
#endif // APPSPRESENTER_HPP

View File

@ -0,0 +1,45 @@
#ifndef APPSVIEW_HPP
#define APPSVIEW_HPP
#include "params.h"
#include <gui/apps_screen/APPSPresenter.hpp>
#include <gui_generated/apps_screen/APPSViewBase.hpp>
class APPSView : public APPSViewBase {
public:
static constexpr int FIELD_COUNT = 4;
APPSView();
virtual ~APPSView() {}
virtual void setupScreen();
virtual void tearDownScreen();
void selectPrevField() override;
void selectNextField() override;
void decField() override;
void incField() override;
void confirmField() override;
void switchPrecision() override;
void abxParamConfirmed(ParamType param);
void updateFieldValues();
void addGraphPoints(float apps0, float apps1);
protected:
private:
int selectedField;
float precision = 0.001f;
bool fieldsDirty[FIELD_COUNT] = {false};
ParamType fieldParams[FIELD_COUNT] = {PF_APPS0_MIN, PF_APPS0_MAX,
PF_APPS1_MIN, PF_APPS1_MAX};
touchgfx::TextAreaWithOneWildcard *fieldWidgets[FIELD_COUNT] = {nullptr};
touchgfx::Box *fieldBackgrounds[FIELD_COUNT] = {nullptr};
touchgfx::Unicode::UnicodeChar fieldBuffers[FIELD_COUNT][16];
touchgfx::Unicode::UnicodeChar apps0Buffer[16];
touchgfx::Unicode::UnicodeChar apps1Buffer[16];
};
#endif // APPSVIEW_HPP