mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Интегрируем LCD2004 в ядро
This commit is contained in:
@@ -4,19 +4,17 @@
|
||||
#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();
|
||||
void writeLCD2004();
|
||||
|
||||
private:
|
||||
unsigned long currentMillis;
|
||||
@@ -31,5 +29,5 @@ class SensorLCD2004 {
|
||||
|
||||
extern MySensorLCD2004Vector* mySensorLCD20042;
|
||||
|
||||
extern void LCD2004();
|
||||
extern void lcd2004();
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "items/vSensorBmp280.h"
|
||||
#include "items/vSensorCcs811.h"
|
||||
#include "items/vSensorDallas.h"
|
||||
#include "items/vSensorLCD2004.h"
|
||||
#include "items/vSensorDht.h"
|
||||
#include "items/vSensorNode.h"
|
||||
#include "items/vSensorPzem.h"
|
||||
@@ -105,6 +106,10 @@ void csvCmdExecute(String& cmdStr) {
|
||||
} else if (order == F("dallas-temp")) {
|
||||
#ifdef EnableSensorDallas
|
||||
sCmd.addCommand(order.c_str(), dallas);
|
||||
#endif
|
||||
} else if (order == F("LCD2004")) {
|
||||
#ifdef EnableSensorLCD2004
|
||||
sCmd.addCommand(order.c_str(), lcd2004);
|
||||
#endif
|
||||
} else if (order == F("dht")) {
|
||||
#ifdef EnableSensorDht
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "items/vSensorBmp280.h"
|
||||
#include "items/vSensorCcs811.h"
|
||||
#include "items/vSensorDallas.h"
|
||||
#include "items/vSensorLCD2004.h"
|
||||
#include "items/vSensorDht.h"
|
||||
#include "items/vSensorNode.h"
|
||||
#include "items/vSensorPzem.h"
|
||||
@@ -169,6 +170,11 @@ void clearVectors() {
|
||||
mySensorDallas2->clear();
|
||||
}
|
||||
#endif
|
||||
#ifdef EnableSensorLCD2004
|
||||
if (mySensorLCD20042 != nullptr) {
|
||||
mySensorLCD20042->clear();
|
||||
}
|
||||
#endif
|
||||
#ifdef EnableSensorUltrasonic
|
||||
if (mySensorUltrasonic != nullptr) {
|
||||
mySensorUltrasonic->clear();
|
||||
|
||||
@@ -26,11 +26,11 @@ void SensorLCD2004::loop() {
|
||||
difference = currentMillis - prevMillis;
|
||||
if (difference >= _interval) {
|
||||
prevMillis = millis();
|
||||
readLCD2004();
|
||||
writeLCD2004();
|
||||
}
|
||||
}
|
||||
|
||||
void SensorLCD2004::readLCD2004() {
|
||||
void SensorLCD2004::writeLCD2004() {
|
||||
//if (_addr == "") {
|
||||
// sensors->getAddress(deviceAddress, _index);
|
||||
//} else {
|
||||
@@ -49,7 +49,7 @@ void SensorLCD2004::readLCD2004() {
|
||||
|
||||
MySensorLCD2004Vector* mySensorLCD20042 = nullptr;
|
||||
|
||||
void LCD2004() {
|
||||
void lcd2004() {
|
||||
myLineParsing.update();
|
||||
String interval = myLineParsing.gint();
|
||||
String pin = myLineParsing.gpin();
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "items/vSensorBmp280.h"
|
||||
#include "items/vSensorCcs811.h"
|
||||
#include "items/vSensorDallas.h"
|
||||
#include "items/vSensorLCD2004.h"
|
||||
#include "items/vSensorDht.h"
|
||||
#include "items/vSensorNode.h"
|
||||
#include "items/vSensorPzem.h"
|
||||
@@ -153,6 +154,13 @@ void loop() {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef EnableSensorLCD2004
|
||||
if (mySensorLCD20042 != nullptr) {
|
||||
for (unsigned int i = 0; i < mySensorLCD20042->size(); i++) {
|
||||
mySensorLCD20042->at(i).loop();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef EnableSensorUltrasonic
|
||||
if (mySensorUltrasonic != nullptr) {
|
||||
for (unsigned int i = 0; i < mySensorUltrasonic->size(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user