mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
добавил шаблон любого сенсора
This commit is contained in:
@@ -84,6 +84,7 @@
|
||||
#define EnableSensorPzem
|
||||
#define EnableSensorUltrasonic
|
||||
#define EnableSensorUptime
|
||||
#define EnableSensorAny
|
||||
#define EnableTelegram
|
||||
#define EnableUart
|
||||
#endif
|
||||
|
||||
@@ -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);
|
||||
|
||||
34
include/items/vSensorAny.h
Normal file
34
include/items/vSensorAny.h
Normal 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
|
||||
4
include/sensors/YourSensor.h
Normal file
4
include/sensors/YourSensor.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
float yourSensorReading(String type);
|
||||
Reference in New Issue
Block a user