mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 11:59:12 +03:00
Добавляем необходимые файлы и первые записи в интервейс для экрана LCD2004
This commit is contained in:
@@ -38,6 +38,5 @@
|
|||||||
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[HDC1080_hum];addr[0x76]*
|
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[HDC1080_hum];addr[0x76]*
|
||||||
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[AHTX0_temp];addr[0x76]
|
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[AHTX0_temp];addr[0x76]
|
||||||
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[AHTX0_hum];addr[0x76]*
|
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[AHTX0_hum];addr[0x76]*
|
||||||
0;sensor;anyid;anydata;Page;Tmp;1;c[0];k[0];int[10];type[LCD];val[any]
|
0;LCD2004;lcdid;anydata;Вывод;Пример;1;addr[0х27];pin[16,2];int[10];c[0,0];val[ip]*
|
||||||
0;sensor;anyid;anydata;Page;Hum;1;c[8];k[1];int[10];type[LCD];val[any]*
|
|
||||||
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[type1];addr[0x76]*
|
0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[type1];addr[0x76]*
|
||||||
@@ -87,6 +87,7 @@
|
|||||||
#define EnableSensorAny
|
#define EnableSensorAny
|
||||||
#define EnableTelegram
|
#define EnableTelegram
|
||||||
#define EnableUart
|
#define EnableUart
|
||||||
|
#define EnableSensorLCD2004
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GATE_MODE
|
#ifdef GATE_MODE
|
||||||
|
|||||||
35
include/items/vSensorLCD2004.h
Normal file
35
include/items/vSensorLCD2004.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#ifdef EnableSensorLCD2004
|
||||||
|
#pragma once
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <OneWire.h>
|
||||||
|
#include "Global.h"
|
||||||
|
|
||||||
|
//ИНТЕГРИРУЮ: следим за наименованиями далее
|
||||||
|
class SensorLCD2004;
|
||||||
|
|
||||||
|
typedef std::vector<SensorLCD2004> MySensorLCD2004Vector;
|
||||||
|
|
||||||
|
class SensorLCD2004 {
|
||||||
|
public:
|
||||||
|
//ИНТЕГРИРУЮ: обращаем внимание на параметры, берутся из таблицы настроек
|
||||||
|
SensorLCD2004(unsigned long interval, unsigned int pin, unsigned int index, String addr, String key);
|
||||||
|
~SensorLCD2004();
|
||||||
|
|
||||||
|
void loop();
|
||||||
|
void readLCD2004();
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned long currentMillis;
|
||||||
|
unsigned long prevMillis;
|
||||||
|
unsigned long difference;
|
||||||
|
unsigned long _interval;
|
||||||
|
String _key;
|
||||||
|
String _addr;
|
||||||
|
unsigned int _pin;
|
||||||
|
unsigned int _index;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern MySensorLCD2004Vector* mySensorLCD20042;
|
||||||
|
|
||||||
|
extern void LCD2004();
|
||||||
|
#endif
|
||||||
66
src/items/vSensorLCD2004.cpp
Normal file
66
src/items/vSensorLCD2004.cpp
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#include "Consts.h"
|
||||||
|
#ifdef EnableSensorLCD2004
|
||||||
|
#include "items/vSensorLCD2004.h"
|
||||||
|
#include "BufferExecute.h"
|
||||||
|
#include "Class/LineParsing.h"
|
||||||
|
#include "Global.h"
|
||||||
|
#include "Utils/StringUtils.h"
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
SensorLCD2004::SensorLCD2004(unsigned long interval, unsigned int pin, unsigned int index, String addr, String key) {
|
||||||
|
_interval = interval * 1000;
|
||||||
|
_key = key;
|
||||||
|
_pin = pin;
|
||||||
|
_index = index;
|
||||||
|
_addr = addr;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SensorLCD2004::~SensorLCD2004() {}
|
||||||
|
|
||||||
|
void SensorLCD2004::loop() {
|
||||||
|
currentMillis = millis();
|
||||||
|
difference = currentMillis - prevMillis;
|
||||||
|
if (difference >= _interval) {
|
||||||
|
prevMillis = millis();
|
||||||
|
readLCD2004();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SensorLCD2004::readLCD2004() {
|
||||||
|
//if (_addr == "") {
|
||||||
|
// sensors->getAddress(deviceAddress, _index);
|
||||||
|
//} else {
|
||||||
|
// string2hex(_addr.c_str(), deviceAddress);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//eventGen2(_key, String(value));
|
||||||
|
//jsonWriteStr(configLiveJson, _key, String(value));
|
||||||
|
//publishStatus(_key, String(value));
|
||||||
|
//char addrStr[20] = "";
|
||||||
|
//hex2string(deviceAddress, 8, addrStr);
|
||||||
|
//SerialPrint("I", "Sensor", "'" + _key + "' data: " + String(value) + "' addr: " + String(addrStr));
|
||||||
|
}
|
||||||
|
|
||||||
|
MySensorLCD2004Vector* mySensorLCD20042 = nullptr;
|
||||||
|
|
||||||
|
void LCD2004() {
|
||||||
|
myLineParsing.update();
|
||||||
|
String interval = myLineParsing.gint();
|
||||||
|
String pin = myLineParsing.gpin();
|
||||||
|
String index = myLineParsing.gindex();
|
||||||
|
String key = myLineParsing.gkey();
|
||||||
|
String addr = myLineParsing.gaddr();
|
||||||
|
myLineParsing.clear();
|
||||||
|
|
||||||
|
static bool firstTime = true;
|
||||||
|
if (firstTime) mySensorLCD20042 = new MySensorLCD2004Vector();
|
||||||
|
firstTime = false;
|
||||||
|
mySensorLCD20042->push_back(SensorLCD2004(interval.toInt(), pin.toInt(), index.toInt(), addr, key));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user