mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
recovery
This commit is contained in:
65
include/items/ButtonInClass.h
Normal file
65
include/items/ButtonInClass.h
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
#ifdef EnableButtonIn
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include <Bounce2.h>
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Global.h"
|
||||
|
||||
extern boolean but[NUM_BUTTONS];
|
||||
extern Bounce* buttons;
|
||||
|
||||
class ButtonInClass : public LineParsing {
|
||||
protected:
|
||||
int numberEntering = 0;
|
||||
int state = _state.toInt();
|
||||
|
||||
public:
|
||||
ButtonInClass() : LineParsing(){};
|
||||
|
||||
void init() {
|
||||
if (_pin != "") {
|
||||
int number = numberEntering++;
|
||||
buttons[number].attach(_pin.toInt());
|
||||
buttons[number].interval(_db.toInt());
|
||||
but[number] = true;
|
||||
jsonWriteStr(configOptionJson, "switch_num_" + String(number), _key);
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
static uint8_t switch_number = 1;
|
||||
if (but[switch_number]) {
|
||||
buttons[switch_number].update();
|
||||
if (buttons[switch_number].fell()) {
|
||||
String key = jsonReadStr(configOptionJson, "switch_num_" + String(switch_number));
|
||||
state = 1;
|
||||
switchChangeVirtual(key, String(state));
|
||||
}
|
||||
if (buttons[switch_number].rose()) {
|
||||
String key = jsonReadStr(configOptionJson, "switch_num_" + String(switch_number));
|
||||
state = 0;
|
||||
switchChangeVirtual(key, String(state));
|
||||
}
|
||||
}
|
||||
switch_number++;
|
||||
if (switch_number == NUM_BUTTONS) {
|
||||
switch_number = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void switchStateSetDefault() {
|
||||
if (_state != "") {
|
||||
switchChangeVirtual(_key, _state);
|
||||
}
|
||||
}
|
||||
|
||||
void switchChangeVirtual(String key, String state) {
|
||||
eventGen2(key, state);
|
||||
jsonWriteInt(configLiveJson, key, state.toInt());
|
||||
publishStatus(key, state);
|
||||
}
|
||||
};
|
||||
|
||||
extern ButtonInClass myButtonIn;
|
||||
#endif
|
||||
34
include/items/test.h
Normal file
34
include/items/test.h
Normal file
@@ -0,0 +1,34 @@
|
||||
//#include "Arduino.h"
|
||||
//#include "Global.h"
|
||||
//
|
||||
//class SensorImpulsIn;
|
||||
//
|
||||
//typedef std::vector<SensorImpulsIn> MySensorImpulsInVector;
|
||||
//
|
||||
//struct paramsImpulsIn {
|
||||
// String key;
|
||||
// unsigned int pin;
|
||||
// float c;
|
||||
// float k;
|
||||
//};
|
||||
//
|
||||
//class SensorImpulsIn {
|
||||
// public:
|
||||
// SensorImpulsIn(const paramsImpulsIn& paramsImpuls);
|
||||
// //~SensorImpulsIn();
|
||||
//
|
||||
// //void begin(int interruptPin);
|
||||
// void classInterruptHandler(void);
|
||||
//
|
||||
// void setCallback(void (*userDefinedCallback)(const int)) {
|
||||
// localPointerToCallback = userDefinedCallback;
|
||||
// }
|
||||
//
|
||||
// private:
|
||||
// void (*localPointerToCallback)(const int);
|
||||
// paramsImpulsIn _paramsImpuls;
|
||||
//};
|
||||
//
|
||||
//extern MySensorImpulsInVector* mySensorImpulsIn;
|
||||
//
|
||||
//extern void impulsInSensor();
|
||||
30
include/items/vButtonOut.h
Normal file
30
include/items/vButtonOut.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifdef EnableButtonOut
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
class ButtonOut;
|
||||
|
||||
typedef std::vector<ButtonOut> MyButtonOutVector;
|
||||
|
||||
class ButtonOut {
|
||||
public:
|
||||
ButtonOut(String pin, boolean inv, String key, String type);
|
||||
|
||||
~ButtonOut();
|
||||
|
||||
void execute(String state);
|
||||
|
||||
private:
|
||||
String _pin;
|
||||
boolean _inv;
|
||||
String _key;
|
||||
String _type;
|
||||
};
|
||||
|
||||
extern MyButtonOutVector* myButtonOut;
|
||||
|
||||
extern void buttonOut();
|
||||
extern void buttonOutExecute();
|
||||
#endif
|
||||
34
include/items/vCountDown.h
Normal file
34
include/items/vCountDown.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifdef EnableCountDown
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
class CountDownClass;
|
||||
|
||||
typedef std::vector<CountDownClass> MyCountDownVector;
|
||||
|
||||
class CountDownClass {
|
||||
public:
|
||||
CountDownClass(String key);
|
||||
~CountDownClass();
|
||||
|
||||
void loop();
|
||||
void execute(unsigned int countDownPeriod);
|
||||
|
||||
private:
|
||||
unsigned long _countDownPeriod = 0;
|
||||
bool _start = false;
|
||||
String _key;
|
||||
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
int sec;
|
||||
};
|
||||
|
||||
extern MyCountDownVector* myCountDown;
|
||||
|
||||
extern void countDown();
|
||||
extern void countDownExecute();
|
||||
#endif
|
||||
33
include/items/vImpulsOut.h
Normal file
33
include/items/vImpulsOut.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifdef EnableImpulsOut
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include "Global.h"
|
||||
|
||||
class ImpulsOutClass;
|
||||
|
||||
typedef std::vector<ImpulsOutClass> MyImpulsOutVector;
|
||||
|
||||
class ImpulsOutClass {
|
||||
public:
|
||||
ImpulsOutClass(unsigned int impulsPin);
|
||||
~ImpulsOutClass();
|
||||
|
||||
void loop();
|
||||
void execute(unsigned long impulsPeriod, unsigned int impulsCount);
|
||||
|
||||
private:
|
||||
unsigned long currentMillis;
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
unsigned long _impulsPeriod = 0;
|
||||
unsigned int _impulsCount = 0;
|
||||
unsigned int _impulsCountBuf = 0;
|
||||
unsigned int _impulsPin = 0;
|
||||
|
||||
};
|
||||
|
||||
extern MyImpulsOutVector* myImpulsOut;
|
||||
|
||||
extern void impuls();
|
||||
extern void impulsExecute();
|
||||
#endif
|
||||
27
include/items/vInput.h
Normal file
27
include/items/vInput.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifdef EnableInput
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Consts.h"
|
||||
#include "Global.h"
|
||||
|
||||
class Input;
|
||||
|
||||
typedef std::vector<Input> MyInputVector;
|
||||
|
||||
class Input {
|
||||
public:
|
||||
Input(String key, String widget);
|
||||
~Input();
|
||||
|
||||
void execute(String value);
|
||||
|
||||
private:
|
||||
String _key;
|
||||
};
|
||||
|
||||
extern MyInputVector* myInput;
|
||||
|
||||
extern void inputValue();
|
||||
extern void inputExecute();
|
||||
#endif
|
||||
44
include/items/vLogging.h
Normal file
44
include/items/vLogging.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifdef EnableLogging
|
||||
#pragma once
|
||||
#include "Consts.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
class LoggingClass;
|
||||
|
||||
typedef std::vector<LoggingClass> MyLoggingVector;
|
||||
|
||||
class LoggingClass {
|
||||
public:
|
||||
|
||||
LoggingClass(String interval, unsigned int maxPoints, String loggingValueKey, String key, String startState, bool savedFromWeb);
|
||||
~LoggingClass();
|
||||
|
||||
void loop();
|
||||
void execute(String keyOrValue);
|
||||
|
||||
private:
|
||||
|
||||
unsigned long currentMillis;
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
String _interval;
|
||||
unsigned int _intervalSec;
|
||||
unsigned int _type = 0;
|
||||
unsigned int _maxPoints;
|
||||
String _loggingValueKey;
|
||||
String _key;
|
||||
|
||||
|
||||
};
|
||||
|
||||
extern MyLoggingVector* myLogging;
|
||||
|
||||
extern void logging();
|
||||
extern void loggingExecute();
|
||||
extern void choose_log_date_and_send();
|
||||
extern void sendLogData(String file, String topic);
|
||||
extern void sendLogData2(String file, String topic);
|
||||
extern void cleanLogAndData();
|
||||
#endif
|
||||
30
include/items/vOutput.h
Normal file
30
include/items/vOutput.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifdef EnableOutput
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
class Output;
|
||||
|
||||
typedef std::vector<Output> MyOutputVector;
|
||||
|
||||
class Output {
|
||||
public:
|
||||
|
||||
Output(String key);
|
||||
~Output();
|
||||
|
||||
void execute(String value);
|
||||
|
||||
private:
|
||||
|
||||
String _key;
|
||||
|
||||
};
|
||||
|
||||
extern MyOutputVector* myOutput;
|
||||
|
||||
extern void outputValue();
|
||||
extern void outputExecute();
|
||||
#endif
|
||||
|
||||
28
include/items/vPwmOut.h
Normal file
28
include/items/vPwmOut.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifdef EnablePwmOut
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include "Consts.h"
|
||||
#include "Global.h"
|
||||
|
||||
class PwmOut;
|
||||
|
||||
typedef std::vector<PwmOut> MyPwmOutVector;
|
||||
|
||||
class PwmOut {
|
||||
public:
|
||||
PwmOut(unsigned int pin, String key);
|
||||
|
||||
~PwmOut();
|
||||
|
||||
void execute(String state);
|
||||
|
||||
private:
|
||||
unsigned int _pin;
|
||||
String _key;
|
||||
};
|
||||
|
||||
extern MyPwmOutVector* myPwmOut;
|
||||
|
||||
extern void pwmOut();
|
||||
extern void pwmOutExecute();
|
||||
#endif
|
||||
41
include/items/vSensorAnalog.h
Normal file
41
include/items/vSensorAnalog.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifdef EnableSensorAnalog
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Global.h"
|
||||
#include "GyverFilters.h"
|
||||
|
||||
class SensorAnalog;
|
||||
|
||||
typedef std::vector<SensorAnalog> MySensorAnalogVector;
|
||||
|
||||
class SensorAnalog {
|
||||
public:
|
||||
SensorAnalog(String key, unsigned long interval, unsigned int adcPin, int map1, int map2, int map3, int map4, float c);
|
||||
~SensorAnalog();
|
||||
|
||||
void loop();
|
||||
void readAnalog();
|
||||
|
||||
private:
|
||||
unsigned long currentMillis;
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
|
||||
unsigned long _interval;
|
||||
|
||||
String _key;
|
||||
unsigned int _adcPin;
|
||||
|
||||
int _map1;
|
||||
int _map2;
|
||||
int _map3;
|
||||
int _map4;
|
||||
|
||||
float _c;
|
||||
};
|
||||
|
||||
extern MySensorAnalogVector* mySensorAnalog;
|
||||
|
||||
extern void analogAdc();
|
||||
#endif
|
||||
41
include/items/vSensorBme280.h
Normal file
41
include/items/vSensorBme280.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifdef EnableSensorBme280
|
||||
#pragma once
|
||||
#include <Adafruit_BME280.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
extern Adafruit_BME280* bme;
|
||||
|
||||
class SensorBme280;
|
||||
|
||||
typedef std::vector<SensorBme280> MySensorBme280Vector;
|
||||
|
||||
struct paramsBme {
|
||||
String key;
|
||||
String addr;
|
||||
unsigned long interval;
|
||||
float c;
|
||||
};
|
||||
|
||||
class SensorBme280 {
|
||||
public:
|
||||
SensorBme280(const paramsBme& paramsTmp, const paramsBme& paramsHum, const paramsBme& paramsPrs);
|
||||
~SensorBme280();
|
||||
|
||||
void loop();
|
||||
void read();
|
||||
|
||||
private:
|
||||
paramsBme _paramsTmp;
|
||||
paramsBme _paramsHum;
|
||||
paramsBme _paramsPrs;
|
||||
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
};
|
||||
|
||||
extern MySensorBme280Vector* mySensorBme280;
|
||||
|
||||
extern void bme280Sensor();
|
||||
#endif
|
||||
40
include/items/vSensorBmp280.h
Normal file
40
include/items/vSensorBmp280.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifdef EnableSensorBmp280
|
||||
#pragma once
|
||||
#include <Adafruit_BMP280.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
extern Adafruit_BMP280* bmp;
|
||||
|
||||
class SensorBmp280;
|
||||
|
||||
typedef std::vector<SensorBmp280> MySensorBmp280Vector;
|
||||
|
||||
struct paramsBmp {
|
||||
String key;
|
||||
String addr;
|
||||
unsigned long interval;
|
||||
float c;
|
||||
};
|
||||
|
||||
class SensorBmp280 {
|
||||
public:
|
||||
SensorBmp280(const paramsBmp& paramsTmp, const paramsBmp& paramsPrs);
|
||||
~SensorBmp280();
|
||||
|
||||
void loop();
|
||||
void read();
|
||||
|
||||
private:
|
||||
paramsBmp _paramsTmp;
|
||||
paramsBmp _paramsPrs;
|
||||
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
};
|
||||
|
||||
extern MySensorBmp280Vector* mySensorBmp280;
|
||||
|
||||
extern void bmp280Sensor();
|
||||
#endif
|
||||
41
include/items/vSensorCcs811.h
Normal file
41
include/items/vSensorCcs811.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifdef EnableSensorCcs811
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Adafruit_CCS811.h"
|
||||
#include "Global.h"
|
||||
#include "GyverFilters.h"
|
||||
|
||||
class SensorCcs811;
|
||||
|
||||
typedef std::vector<SensorCcs811> MySensorCcs811Vector;
|
||||
|
||||
struct paramsCcs811 {
|
||||
String key;
|
||||
String addr;
|
||||
unsigned long interval;
|
||||
float c;
|
||||
};
|
||||
|
||||
class SensorCcs811 {
|
||||
public:
|
||||
SensorCcs811(const paramsCcs811& paramsPpm, const paramsCcs811& paramsPpb);
|
||||
~SensorCcs811();
|
||||
|
||||
Adafruit_CCS811* ccs811;
|
||||
|
||||
void loop();
|
||||
void read();
|
||||
|
||||
private:
|
||||
paramsCcs811 _paramsPpm;
|
||||
paramsCcs811 _paramsPpb;
|
||||
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
};
|
||||
|
||||
extern MySensorCcs811Vector* mySensorCcs811;
|
||||
|
||||
extern void ccs811Sensor();
|
||||
#endif
|
||||
37
include/items/vSensorDallas.h
Normal file
37
include/items/vSensorDallas.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifdef EnableSensorDallas
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
#include "Global.h"
|
||||
|
||||
|
||||
extern DallasTemperature sensors;
|
||||
extern OneWire* oneWire;
|
||||
|
||||
class SensorDallas;
|
||||
|
||||
typedef std::vector<SensorDallas> MySensorDallasVector;
|
||||
|
||||
class SensorDallas {
|
||||
public:
|
||||
SensorDallas(unsigned long interval, unsigned int pin, unsigned int index, String key);
|
||||
~SensorDallas();
|
||||
|
||||
void loop();
|
||||
void readDallas();
|
||||
|
||||
private:
|
||||
unsigned long currentMillis;
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
unsigned long _interval;
|
||||
String _key;
|
||||
unsigned int _pin;
|
||||
unsigned int _index;
|
||||
};
|
||||
|
||||
extern MySensorDallasVector* mySensorDallas2;
|
||||
|
||||
extern void dallas();
|
||||
#endif
|
||||
42
include/items/vSensorDht.h
Normal file
42
include/items/vSensorDht.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifdef EnableSensorDht
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include <DHTesp.h>
|
||||
|
||||
#include "Global.h"
|
||||
#include "GyverFilters.h"
|
||||
|
||||
class SensorDht;
|
||||
|
||||
typedef std::vector<SensorDht> MySensorDhtVector;
|
||||
|
||||
struct paramsDht {
|
||||
String type;
|
||||
String key;
|
||||
unsigned long interval;
|
||||
unsigned int pin;
|
||||
float c;
|
||||
};
|
||||
|
||||
class SensorDht {
|
||||
public:
|
||||
SensorDht(const paramsDht& paramsTmp, const paramsDht& paramsHum);
|
||||
~SensorDht();
|
||||
|
||||
DHTesp* dht;
|
||||
|
||||
void loop();
|
||||
void readTmpHum();
|
||||
|
||||
private:
|
||||
paramsDht _paramsTmp;
|
||||
paramsDht _paramsHum;
|
||||
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
};
|
||||
|
||||
extern MySensorDhtVector* mySensorDht;
|
||||
|
||||
extern void dhtSensor();
|
||||
#endif
|
||||
32
include/items/vSensorImpulsIn.h
Normal file
32
include/items/vSensorImpulsIn.h
Normal file
@@ -0,0 +1,32 @@
|
||||
//#pragma once
|
||||
//#include <Arduino.h>
|
||||
//
|
||||
//#include "Global.h"
|
||||
//#include "PZEMSensor.h"
|
||||
//#include "SoftUART.h"
|
||||
//
|
||||
//class SensorImpulsIn;
|
||||
//
|
||||
//typedef std::vector<SensorImpulsIn> MySensorImpulsInVector;
|
||||
//
|
||||
//struct paramsImpulsIn {
|
||||
// String key;
|
||||
// unsigned int pin;
|
||||
// float c;
|
||||
// float k;
|
||||
//};
|
||||
//
|
||||
//class SensorImpulsIn {
|
||||
// public:
|
||||
// SensorImpulsIn(const paramsImpulsIn& paramsImpuls);
|
||||
// ~SensorImpulsIn();
|
||||
//
|
||||
// void interruptHandler(void);
|
||||
//
|
||||
// private:
|
||||
// paramsImpulsIn _paramsImpuls;
|
||||
//};
|
||||
//
|
||||
//extern MySensorImpulsInVector* mySensorImpulsIn;
|
||||
//
|
||||
//extern void impulsInSensor();
|
||||
41
include/items/vSensorNode.h
Normal file
41
include/items/vSensorNode.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifdef EnableSensorNode
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
class SensorNode;
|
||||
|
||||
typedef std::vector<SensorNode> MySensorNodeVector;
|
||||
|
||||
struct paramsSensorNode {
|
||||
String tm1;
|
||||
String tm2;
|
||||
String key;
|
||||
float c;
|
||||
float k;
|
||||
};
|
||||
|
||||
class SensorNode {
|
||||
public:
|
||||
SensorNode(const paramsSensorNode& params);
|
||||
~SensorNode();
|
||||
|
||||
void loop();
|
||||
void onChange(String newValue, String incommingKey);
|
||||
void publish();
|
||||
|
||||
private:
|
||||
paramsSensorNode _params;
|
||||
long _minutesPassed;
|
||||
String _updateTime;
|
||||
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
};
|
||||
|
||||
extern MySensorNodeVector* mySensorNode;
|
||||
|
||||
extern void nodeSensor();
|
||||
extern void publishTimes();
|
||||
#endif
|
||||
46
include/items/vSensorPzem.h
Normal file
46
include/items/vSensorPzem.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifdef EnableSensorPzem
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Global.h"
|
||||
#include "PZEMSensor.h"
|
||||
#include "SoftUART.h"
|
||||
|
||||
class SensorPzem;
|
||||
|
||||
typedef std::vector<SensorPzem> MySensorPzemVector;
|
||||
|
||||
struct paramsPzem {
|
||||
String key;
|
||||
String addr;
|
||||
unsigned long interval;
|
||||
float c;
|
||||
float k;
|
||||
};
|
||||
|
||||
class SensorPzem {
|
||||
public:
|
||||
SensorPzem(const paramsPzem& paramsV, const paramsPzem& paramsA, const paramsPzem& paramsWatt, const paramsPzem& paramsWattHrs, const paramsPzem& paramsHz);
|
||||
~SensorPzem();
|
||||
|
||||
void loop();
|
||||
|
||||
private:
|
||||
void read();
|
||||
|
||||
paramsPzem _paramsV;
|
||||
paramsPzem _paramsA;
|
||||
paramsPzem _paramsWatt;
|
||||
paramsPzem _paramsWattHrs;
|
||||
paramsPzem _paramsHz;
|
||||
|
||||
PZEMSensor* pzem;
|
||||
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
};
|
||||
|
||||
extern MySensorPzemVector* mySensorPzem;
|
||||
|
||||
extern void pzemSensor();
|
||||
#endif
|
||||
42
include/items/vSensorUltrasonic.h
Normal file
42
include/items/vSensorUltrasonic.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifdef EnableSensorUltrasonic
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Global.h"
|
||||
#include "GyverFilters.h"
|
||||
|
||||
class SensorUltrasonic;
|
||||
|
||||
typedef std::vector<SensorUltrasonic> MySensorUltrasonicVector;
|
||||
|
||||
class SensorUltrasonic {
|
||||
public:
|
||||
SensorUltrasonic(String key, unsigned long interval, unsigned int trig, unsigned int echo, int map1, int map2, int map3, int map4, float c);
|
||||
~SensorUltrasonic();
|
||||
|
||||
void loop();
|
||||
void readUltrasonic();
|
||||
|
||||
private:
|
||||
unsigned long currentMillis;
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
|
||||
unsigned long _interval;
|
||||
|
||||
String _key;
|
||||
unsigned int _echo;
|
||||
unsigned int _trig;
|
||||
|
||||
int _map1;
|
||||
int _map2;
|
||||
int _map3;
|
||||
int _map4;
|
||||
|
||||
float _c;
|
||||
};
|
||||
|
||||
extern MySensorUltrasonicVector* mySensorUltrasonic;
|
||||
|
||||
extern void ultrasonic();
|
||||
#endif
|
||||
35
include/items/vSensorUptime.h
Normal file
35
include/items/vSensorUptime.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifdef EnableSensorUptime
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Global.h"
|
||||
#include "GyverFilters.h"
|
||||
|
||||
class SensorUptime;
|
||||
|
||||
typedef std::vector<SensorUptime> MySensorUptimeVector;
|
||||
|
||||
struct paramsUptime {
|
||||
String key;
|
||||
unsigned long interval;
|
||||
};
|
||||
|
||||
class SensorUptime {
|
||||
public:
|
||||
SensorUptime(const paramsUptime& paramsUpt);
|
||||
~SensorUptime();
|
||||
|
||||
void loop();
|
||||
void read();
|
||||
|
||||
private:
|
||||
paramsUptime _paramsUpt;
|
||||
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
};
|
||||
|
||||
extern MySensorUptimeVector* mySensorUptime;
|
||||
|
||||
extern void uptimeSensor();
|
||||
#endif
|
||||
Reference in New Issue
Block a user