48 lines
962 B
C++
48 lines
962 B
C++
#ifndef __screen_calibrate
|
|
#define __screen_calibrate
|
|
|
|
#include "include/screenids.h"
|
|
#include "../screen.h"
|
|
#include "../control.h"
|
|
|
|
|
|
enum CalibrateStep : uint8_t
|
|
{
|
|
CalibrateStepCurrent = 0,
|
|
CalibrateStepMax,
|
|
CalibrateStepMin,
|
|
|
|
CalibrateStepCount
|
|
};
|
|
|
|
|
|
/*
|
|
* Calibrate screen
|
|
* Configures the absolute height (calculates the offset) and
|
|
* the allowed minimum and maximum absolute height.
|
|
*/
|
|
class CalibrateScreen : public BaseScreen
|
|
{
|
|
public:
|
|
CalibrateScreen(ScreenManager* screenManager, Adafruit_GFX* display) : BaseScreen(screenManager, display) { }
|
|
|
|
void onShow();
|
|
void onButton(Button button);
|
|
void onTick();
|
|
|
|
ScreenId screenId() { return ScreenId::Calibrate; };
|
|
|
|
private:
|
|
bool isValidHeight();
|
|
void drawTitle();
|
|
void drawSetHeight();
|
|
|
|
CalibrateStep step = CalibrateStepCurrent;
|
|
|
|
uint16_t height[CalibrateStepCount];
|
|
uint16_t lastTextWidth = 0;
|
|
uint8_t editingDigit = 0;
|
|
};
|
|
|
|
#endif
|