#ifndef EEZ_LVGL_UI_VARS_H
#define EEZ_LVGL_UI_VARS_H

#include <stdint.h>
#include <stdbool.h>
#include <time.h>

#ifdef __cplusplus
extern "C" {
#endif

#define HISTLEN 48*12
#define TMP_HYST 0.5
#define PIN_REL 20
#define PWM_REL 2


// enum declarations
typedef struct hist_s{
  int32_t temp[HISTLEN];
  int32_t hum[HISTLEN];
  int32_t press[HISTLEN];
} hist_t;




typedef enum override_e{
    OVR_NONE,
    OVR_ALWAYSON,
    OVR_ALWAYSOFF
} override_t;

typedef enum wifistrength_e{
  WIFISTRENGTH_OFF,
  WIFISTRENGTH_LOW,
  WIFISTRENGTH_MED,
  WIFISTRENGTH_HIGH,
  WIFISTRENGTH_ERROR
} wifistrength_t;

typedef enum wifimode_e{
  WIFIMODE_OFF,
  WIFIMODE_STA,
  WIFIMODE_AP,
  WIFIMODE_APSTA
} wifimode_t;

typedef struct dataset_s{
    float temp;
    float hum;
    float pres;
    float seaLevelPress;
    float settemp;
    float outTemp;
    bool heating;
    bool enBuff;
    bool relPowerSave;
    bool presAlarm;
    char myIP[16];
    wifistrength_t wifiStrength;
    wifimode_t wifiMode;
    override_t override;
    struct tm bootTime;
}dataset_t;




extern dataset_t glblData;

// Native global variables

int32_t* history_getPressPt(void);
int32_t* history_getHumPt(void);
int32_t* history_getTempPt(void);
bool history_isInitialized(void);
void history_setPress(const uint16_t index, const float _press);
void history_setHum(uint16_t index, float _hum);
void history_setTemp(const uint16_t index, const float _temp);
void history_append(const float _press, const float _temp, const float _hum);

extern hist_t history;

#ifdef __cplusplus
}
#endif

#endif /*EEZ_LVGL_UI_VARS_H*/