#ifndef nodeReading_h
#define nodeReading_h

#include <Wire.h>
#include <Adafruit_SH110X.h>
#include <DHT.h>
#include <Adafruit_SGP30.h>
#include "websockets.h"

// define pins on esp32
#define MICPIN 6
#define DHTPIN 7
#define SCL 9
#define SDA 8
#define DHTTYPE DHT22
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define i2c_adress 0x3c
#define OLED_RESET -1 //   QT-PY / XIAO

#define USE_SERIAL Serial

class nodeReadings
{

public:
    nodeReadings();
    void setup();
    void loop();
    void resetValues();
    void update();
    void checkForError();
    void displayData();

private:
    DHT *dht;
    Adafruit_SH1106G *display;
    websockets *webSocket;
    Adafruit_SGP30 *sgp;

    uint16_t TVOC_base, eCO2_base;
    uint16_t counter;
    uint16_t eCO2;
    uint16_t TVOC;
    uint16_t interval;
    float temperature;
    float humidity;
    unsigned long currentMillis;
    unsigned long lastMillis;
    bool errorSGP30;
    bool errorDHT11;
    bool noise;
};

#endif