#ifndef GRAFIK_H
#define GRAFIK_H

/*  Install the "lvgl" library version 9.X by kisvegabor to interface with the TFT Display - https://lvgl.io/
    *** IMPORTANT: lv_conf.h available on the internet will probably NOT work with the examples available at Random Nerd Tutorials ***
    *** YOU MUST USE THE lv_conf.h FILE PROVIDED IN THE LINK BELOW IN ORDER TO USE THE EXAMPLES FROM RANDOM NERD TUTORIALS ***
    FULL INSTRUCTIONS AVAILABLE ON HOW CONFIGURE THE LIBRARY: https://RandomNerdTutorials.com/cyd-lvgl/ or https://RandomNerdTutorials.com/esp32-tft-lvgl/   */
#include <lvgl.h>

/*  Install the "TFT_eSPI" library by Bodmer to interface with the TFT Display - https://github.com/Bodmer/TFT_eSPI
    *** IMPORTANT: User_Setup.h available on the internet will probably NOT work with the examples available at Random Nerd Tutorials ***
    *** YOU MUST USE THE User_Setup.h FILE PROVIDED IN THE LINK BELOW IN ORDER TO USE THE EXAMPLES FROM RANDOM NERD TUTORIALS ***
    FULL INSTRUCTIONS AVAILABLE ON HOW CONFIGURE THE LIBRARY: https://RandomNerdTutorials.com/cyd-lvgl/ or https://RandomNerdTutorials.com/esp32-tft-lvgl/   */
#include <TFT_eSPI.h>

typedef struct {
    lv_obj_t * arc;
    const char * name;
    int x;
    int y;
    int size;
    float value;
    const char*  valformat;
    const char* const unit;
    int lowvalue;
    int highvalue;
    int green;
    int yellow;
    int value_xoffset;
    float value_offset;

} ARC;


#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240

#ifdef MAIN
ARC arcTemp = {NULL, "temp", 40, -10, 110, 30.0, "%.1f°C", "°C", 15, 35, 20, 25, -11, 0.0};
ARC arcHum = {NULL, "humi", 170, -10, 110, 60.0, "%.0f%%", "%", 40, 100, 65, 70, 2, 0.0};
lv_obj_t * date_label;
lv_obj_t * time_label;
lv_obj_t * ta_label;
lv_obj_t * fa_label;
lv_obj_t * bmr_label;
lv_obj_t * tta_label;
lv_obj_t * tfa_label;
#else 
extern ARC arcTemp;
extern ARC arcHum;
extern lv_obj_t * date_label;
extern lv_obj_t * time_label;
extern lv_obj_t * ta_label;
extern lv_obj_t * fa_label;
extern lv_obj_t * bmr_label;
extern lv_obj_t * tta_label;
extern lv_obj_t * tfa_label;
#endif


void setup_grafik(void);
void lv_create_main_gui(void);
void setValuetoArc(ARC arc, float value);
void drawChart();
void updatechartData(float value, float value_hum);
void setAussenDataValues(float val, bool what, struct tm t);
void showRate(int r);
void show2lines();
void showResetTime(struct tm tinfo);
void setDateTime(char *time, char *date);





  
#endif