This commit is contained in:
Dmitry Borisenko
2021-01-04 00:39:35 +01:00
parent bf9855aa60
commit 5eb3c6d3a3
339 changed files with 21164 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
#pragma once
#include "Global.h"
#include "PZEMSensor.h"
class SensorPZEM {
public:
SensorPZEM(SoftwareSerial* serial, uint32_t addr, uint32_t interval, String key) : _lastUpdate{0},
_interval{interval},
_key{key} {
_pzem = new PZEMSensor(serial, addr);
}
~SensorPZEM() {
delete _pzem;
}
void loop(void);
private:
void readSensor(void);
String getDataKey(const char* param_key);
void post(const char* key, const String& value);
private:
PZEMSensor* _pzem;
uint32_t _lastUpdate;
uint32_t _interval;
String _key;
};
extern SensorPZEM* myPowerSensor;