2020-12-21 01:46:11 +01:00
|
|
|
#pragma once
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
#include <DHTesp.h>
|
2020-12-22 12:38:05 +01:00
|
|
|
|
2020-12-21 01:46:11 +01:00
|
|
|
#include "Global.h"
|
|
|
|
|
#include "GyverFilters.h"
|
|
|
|
|
|
|
|
|
|
class SensorDht;
|
|
|
|
|
|
|
|
|
|
typedef std::vector<SensorDht> MySensorDhtVector;
|
|
|
|
|
|
2020-12-26 01:22:43 +01:00
|
|
|
struct paramsDht {
|
2020-12-22 12:38:05 +01:00
|
|
|
String type;
|
2020-12-21 01:46:11 +01:00
|
|
|
String key;
|
|
|
|
|
unsigned long interval;
|
|
|
|
|
unsigned int pin;
|
|
|
|
|
float c;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class SensorDht {
|
|
|
|
|
public:
|
2020-12-26 01:22:43 +01:00
|
|
|
SensorDht(const paramsDht& paramsTmp, const paramsDht& paramsHum);
|
2020-12-21 01:46:11 +01:00
|
|
|
~SensorDht();
|
|
|
|
|
|
2021-01-03 19:44:09 +01:00
|
|
|
DHTesp* dht;
|
|
|
|
|
|
2020-12-22 12:38:05 +01:00
|
|
|
void loop();
|
|
|
|
|
void readTmpHum();
|
2020-12-21 01:46:11 +01:00
|
|
|
|
|
|
|
|
private:
|
2020-12-26 01:22:43 +01:00
|
|
|
paramsDht _paramsTmp;
|
|
|
|
|
paramsDht _paramsHum;
|
2021-01-03 19:44:09 +01:00
|
|
|
|
2020-12-22 12:38:05 +01:00
|
|
|
unsigned long prevMillis;
|
|
|
|
|
unsigned long difference;
|
2020-12-21 01:46:11 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern MySensorDhtVector* mySensorDht;
|
|
|
|
|
|
2020-12-24 01:41:15 +01:00
|
|
|
extern void dhtSensor();
|