#ifndef __screen_calibrate
#define __screen_calibrate

#include "include/screenids.h"
#include "./baseheightentry.h"
#include "../screen.h"
#include "../control.h"


enum CalibrateStep
{
    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 BaseHeightEntryScreen
{
  public:
    CalibrateScreen(ScreenManager* screenManager, Adafruit_GFX* display) : BaseHeightEntryScreen(screenManager, display) { }

    ScreenId screenId() { return ScreenId::Calibrate; };

  protected:
    void initHeights();
    uint16_t getHeight() { return this->height[this->step]; }
    void setHeight(uint16_t value) { this->height[this->step] = value; };
    bool nextPage();

    bool isValidHeight();
    const char* getTitle();

  private:
    CalibrateStep step = CalibrateStepCurrent;

    uint16_t height[__CalibrateStepCount];
};

#endif
