80 lines
1.8 KiB
C++
80 lines
1.8 KiB
C++
#ifndef ENDURANCEVIEW_HPP
|
|
#define ENDURANCEVIEW_HPP
|
|
|
|
#include "touchgfx/Unicode.hpp"
|
|
#include "touchgfx/widgets/BoxWithBorder.hpp"
|
|
#include "touchgfx/widgets/TextAreaWithWildcard.hpp"
|
|
#include <cstddef>
|
|
#include <gui/endurance_screen/EndurancePresenter.hpp>
|
|
#include <gui_generated/endurance_screen/EnduranceViewBase.hpp>
|
|
|
|
class BatDelta {
|
|
public:
|
|
BatDelta(touchgfx::BoxWithBorder &box,
|
|
touchgfx::TextAreaWithOneWildcard &field);
|
|
|
|
void setBox(touchgfx::BoxWithBorder &box);
|
|
void setField(touchgfx::TextAreaWithOneWildcard &field);
|
|
void setDelta(float delta);
|
|
|
|
protected:
|
|
touchgfx::BoxWithBorder &box;
|
|
touchgfx::TextAreaWithOneWildcard &field;
|
|
|
|
touchgfx::Unicode::UnicodeChar buffer[16];
|
|
|
|
int value;
|
|
};
|
|
|
|
class ValueBuffer {
|
|
public:
|
|
ValueBuffer(touchgfx::TextAreaWithOneWildcard &field, size_t intDigits,
|
|
size_t decimalDigits);
|
|
|
|
void setField(touchgfx::TextAreaWithOneWildcard &field);
|
|
void setIntValue(int value);
|
|
void setFloatValue(float value);
|
|
|
|
protected:
|
|
touchgfx::TextAreaWithOneWildcard &field;
|
|
|
|
touchgfx::Unicode::UnicodeChar buffer[16];
|
|
|
|
size_t intDigits;
|
|
size_t decimalDigits;
|
|
|
|
union {
|
|
int i;
|
|
float f;
|
|
} value;
|
|
};
|
|
|
|
class EnduranceView : public EnduranceViewBase {
|
|
public:
|
|
EnduranceView();
|
|
virtual ~EnduranceView() {}
|
|
virtual void setupScreen() override;
|
|
virtual void tearDownScreen() override;
|
|
|
|
void updateBatDelta();
|
|
void updateDetails();
|
|
void updateProgress();
|
|
|
|
void decreasePowerLimit() override;
|
|
void increasePowerLimit() override;
|
|
void decreaseSpeedLimit() override;
|
|
void increaseSpeedLimit() override;
|
|
|
|
protected:
|
|
BatDelta lastLapDelta;
|
|
BatDelta overallDelta;
|
|
ValueBuffer plimBuffer;
|
|
ValueBuffer slimBuffer;
|
|
ValueBuffer socBuffer;
|
|
ValueBuffer tbatBuffer;
|
|
|
|
bool limitsChangable();
|
|
};
|
|
|
|
#endif // ENDURANCEVIEW_HPP
|