#include "Arduino.h"
#include "board.h"

#include "status.h"

#define TFT_WIDTH             240
#define TFT_HEIGT             320
#define TFT_DEFAULT_R           4
#define TFT_ROTATION            0 //2 = upsidedown

#define LCD_INTERVAL          100

#define BUTTON_H                60
#define BUTTON_W              TFT_WIDTH
#define BUTTONS_N               3
#define BUTTON_PADDING          2
#define BUTTON_RADIUS           8
#define BUTTON_COLOR          TFT_BLUE
#define BUTTON_INTERVAL        20

#define KEY_TEXTSIZE            1   // Font size multiplier

#define CHART_X                 0
#define CHART_Y                40
#define CHART_Y_AXIS_OFFSET    24
#define CHART_X_AXIS_OFFSET    10
#define CHART_W               TFT_WIDTH - 5
#define CHART_H               200
#define CHART_FONT              1

#define CHART_TIME_MAX        140  //time scale in seconds
#define CHART_TEMP_MIN         20  //offset in degrees
#define CHART_TEMP_MAX        240  //degrees
#define CHART_Y_TICKS           10
#define CHART_X_TICKS           7
#define CHART_LINE_COLOR      TFT_WHITE
#define CHART_TEXT_COLOR      TFT_RED
#define CHART_TARGET_COLOR    TFT_LIGHTGREY
#define CHART_ACTUAL_COLOR    TFT_RED
#define CHART_BG_COLOR        TFT_BLACK


#define STATE_X                 0
#define STATE_Y                13
#define STATE_W               TFT_WIDTH
#define STATE_H                24
#define STATE_FONT              2
#define STATE_OFFSET            3
#define STATE_F_COLOR           TFT_BLACK
#define STATE_R                 TFT_DEFAULT_R
#define STATE_BG_COLOR          TFT_GREEN

#define TEMP_W                 60
#define TEMP_H                 40
#define TEMP_X                 CHART_W - TEMP_W - 20//allign right
#define TEMP_Y                 40
#define TEMP_FONT               2
#define TEMP_F_COLOR            TFT_WHITE
#define TEMP_BG_COLOR           TFT_BLUE
#define TEMP_R                  TFT_DEFAULT_R
#define TEMP_LABEL_X            2
#define TEMP_VALUE_X            20

#define OUTPUT_W               12
#define OUTPUT_H               12
#define OUTPUT_R                5
#define OUTPUT_Y                0
#define OUTPUT_X              TFT_WIDTH - OUTPUT_W - 2
#define OUTPUT_ON_COLOR       TFT_RED
#define OUTPUT_OFF_COLOR      TFT_WHITE
#define OUTPUT_BG             TFT_BLACK



#define DEBOUNCE_MS 100

void initLCD(void);
void handleLCD(void);

void loopScreen(void);
