Files
CYD_Bad/src/grafik.h
2024-07-21 14:25:28 +02:00

67 lines
2.1 KiB
C

#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_offset;
} ARC;
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define BACKGROUND_COLOR 0xD3F0FF
#ifdef MAIN
ARC arcTemp = {NULL, "temp", 40, -1, 110, 30.0, "%.1f°C", "°C", 10, 30, 20, 25, -11};
ARC arcHum = {NULL, "humi", 170, -1, 110, 60.0, "%.0f%%", "%", 40, 100, 65, 70, 2};
lv_obj_t * date_label;
lv_obj_t * time_label;
lv_obj_t * ta_label;
lv_obj_t * fa_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;
#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);
#endif