добавил шаблон любого сенсора

This commit is contained in:
Dmitry Borisenko
2021-12-14 23:05:42 +01:00
parent bc8f683c79
commit d2a375dc9e
8 changed files with 131 additions and 5 deletions

View File

@@ -84,6 +84,7 @@
#define EnableSensorPzem
#define EnableSensorUltrasonic
#define EnableSensorUptime
#define EnableSensorAny
#define EnableTelegram
#define EnableUart
#endif

View File

@@ -8,6 +8,8 @@ int jsonReadInt(String& json, String name);
boolean jsonReadBool(String& json, String name);
float jsonReadFloat(String& json, String name);
String jsonWriteStr(String& json, String name, String value);
String jsonWriteInt(String& json, String name, int value);

View File

@@ -0,0 +1,34 @@
#ifdef EnableSensorAny
#pragma once
#include <Arduino.h>
#include "Global.h"
class SensorAny;
typedef std::vector<SensorAny> MySensorAnyVector;
class SensorAny {
public:
SensorAny(const String& paramsAny);
~SensorAny();
void loop();
void read();
private:
String _paramsAny;
int _interval;
float _c;
String _key;
String _addr;
String _type;
unsigned long prevMillis;
unsigned long difference;
};
extern MySensorAnyVector* mySensorAny;
extern void AnySensor();
#endif

View File

@@ -0,0 +1,4 @@
#pragma once
#include <Arduino.h>
float yourSensorReading(String type);