#ifndef __config
#define __config


// The default color set provided by Adafruit
#define BLACK    0x0000
#define BLUE     0x001F
#define RED      0xF800
#define GREEN    0x07E0
#define CYAN     0x07FF
#define MAGENTA  0xF81F
#define YELLOW   0xFFE0
#define WHITE    0xFFFF


    /*

    TODO make constants for these values once they are used

    #define STOP_RED 0xF9A6
    #define MOVING_ORANGE 0xF443
    #define MOVING_ORANGE_LIGHT 0xFD8C
    */



class Config
{
  public:
    /*

      Display
        Settings for an ST7789 based 240x240 pixel LCD.

        Note that all screen class implementations are only tested against
        this resolution, changing it may have unexpected results.
    */
    static const uint8_t DisplayWidth = 240;
    static const uint8_t DisplayHeight = 240;
    static const uint8_t DisplayRotation = 2;


    // Control pins. Data is sent over the hardware SPI pins.
    static const uint8_t DisplayPortCS = 10;
    static const uint8_t DisplayPortRST = 9;
    static const uint8_t DisplayPortDC = 8;
    static const uint8_t DisplayPortBL = 7;


    /*
      Height sensor
        Settings for a VL53L0X time-of-flight sensor.

    */
    // Note that this must correspond to the default address of the module,
    // the initialisation code skips reassigning the address to save calls.
    static const uint8_t HeightSensorI2CAddress = 0x29;

    static const uint16_t HeightSensorBudget = 33000;


    // Values above this will be disregarded as invalid
    static const uint16_t HeightMeasurementMax = 1500;

    // How much the measurements can change to still be considered "stable"
    static const uint8_t HeightMeasurementDeltaStable = 5;

    // How far in advance to stop the motor
    static const uint8_t HeightMeasurementDeltaStop = 0;

    // How far off we can be from the target height to still be considered on target
    static const uint8_t HeightMeasurementDeltaOnTarget = 5;

    // How long we allow invalid measurements until the move operation is aborted
    static const uint8_t HeightMeasurementAbortTimeout = 100;



    /*

      Colors

    */


    // A useful RGB565 calculator: http://www.rinkydinkelectronics.com/calc_rgb565.php

    static const uint16_t ColorInitSeqBackground = BLACK;
    static const uint16_t ColorInitSeqTitle = YELLOW;
    static const uint16_t ColorInitSeqItems = WHITE;
    static const uint16_t ColorInitSeqSuccess = GREEN;
    static const uint16_t ColorInitSeqError = RED;

    static const uint16_t ColorMenuBackground = BLACK;

    static const uint16_t ColorPresetText = 0x9492;                 // Light gray
    static const uint16_t ColorPresetBackground = BLACK;
    static const uint16_t ColorPresetNumber = 0x528A;               // Dark gray

    static const uint16_t ColorPresetSelectedText = WHITE;
    static const uint16_t ColorPresetSelectedBackground = 0x2BE7;   // Soft green
    static const uint16_t ColorPresetSelectedNumber = 0x556B;       // Slightly lighter green

};

#endif