mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
dht working
This commit is contained in:
@@ -9,10 +9,10 @@
|
||||
0;analog-adc;id;fillgauge;Сенсоры;Аналоговый;order;pin[0];map[0,1024,0,100];c[1];int[10]*
|
||||
0;dallas-temp;id;anydataTemp;Сенсоры;Температура;order;pin[2];index[0];int[10]*
|
||||
0;ultrasonic-cm;id;anydata;Сенсоры;Расстояние;order;pin[12,13];map[0,500,0,100];c[1];int[10]*
|
||||
0;dht-temp;id;anydataTemp;Сенсоры;Температура;order;pin[2];type[dht11];c[1];int[10]
|
||||
0;dht-hum;id;anydataHum;Сенсоры;Влажность;order;pin[2];type[dht11];c[1];int[10]*
|
||||
0;dht-temp;id;anydataTemp;Сенсоры;Температура;order;pin[2];type[dht22];c[1];int[10]
|
||||
0;dht-hum;id;anydataHum;Сенсоры;Влажность;order;pin[2];type[dht22];c[1];int[10]*
|
||||
0;dht;dhtTmp;anydataTemp;Сенсоры;Температура;1;pin[2];type[dht11];c[1];int[10]
|
||||
0;dht;dhtHum;anydataHum;Сенсоры;Влажность;2;pin[2];type[dht11];c[1];int[10]*
|
||||
0;dht;dhtTmp;anydataTemp;Сенсоры;Температура;1;pin[2];type[dht22];c[1];int[10]
|
||||
0;dht;dhtHum;anydataHum;Сенсоры;Влажность;2;pin[2];type[dht22];c[1];int[10]*
|
||||
0;bme280-temp;id;anydataTemp;Сенсоры;Температура;order;addr[0x76];c[1]
|
||||
0;bme280-hum;id;anydataHum;Сенсоры;Влажность;order;addr[0x76];c[1]
|
||||
0;bme280-press;id;anydataPress;Сенсоры;Давление;order;addr[0x76];c[1]*
|
||||
@@ -22,6 +22,4 @@
|
||||
0;count-down;id;anydata;Таймер;Обратный#отчет;order*
|
||||
0;inoutput;id;anydata;Вывод;Вывод#uart;order*
|
||||
0;logging;id;chart;Графики;История;order;val[any];int[60];cnt[100]*
|
||||
0;uptime;id;anydataTime;Системные;%name%#uptime;order*
|
||||
|
||||
|
||||
0;uptime;id;anydataTime;Системные;%name%#uptime;order*
|
||||
@@ -31,13 +31,12 @@ class SensorDht {
|
||||
params _paramsTmp;
|
||||
params _paramsHum;
|
||||
|
||||
unsigned int interval;
|
||||
|
||||
unsigned int _interval;
|
||||
|
||||
unsigned long prevMillis;
|
||||
unsigned long difference;
|
||||
};
|
||||
|
||||
extern MySensorDhtVector* mySensorDht;
|
||||
|
||||
extern void dhtTmp();
|
||||
extern void dhtHum();
|
||||
extern void dhtSensor();
|
||||
@@ -74,11 +74,8 @@ void csvCmdExecute(String& cmdStr) {
|
||||
sCmd.addCommand(order.c_str(), dallas);
|
||||
}
|
||||
#ifdef SensorDhtEnabled
|
||||
else if (order == F("dht-temp")) {
|
||||
//sCmd.addCommand(order.c_str(), dhtTmp);
|
||||
}
|
||||
else if (order == F("dht-hum")) {
|
||||
//sCmd.addCommand(order.c_str(), dhtHum);
|
||||
else if (order == F("dht")) {
|
||||
sCmd.addCommand(order.c_str(), dhtSensor);
|
||||
}
|
||||
#endif
|
||||
#ifdef SensorBme280Enabled
|
||||
|
||||
@@ -18,15 +18,15 @@ SensorDht::SensorDht(const params& paramsTmp, const params& paramsHum) {
|
||||
|
||||
dht->setup(_paramsTmp.pin, DHTesp::DHT11);
|
||||
|
||||
interval = _paramsTmp.interval < _paramsHum.interval ? _paramsTmp.interval : _paramsHum.interval;
|
||||
interval = interval + dht->getMinimumSamplingPeriod();
|
||||
_interval = _paramsTmp.interval < _paramsHum.interval ? _paramsTmp.interval : _paramsHum.interval;
|
||||
_interval = _interval + dht->getMinimumSamplingPeriod();
|
||||
}
|
||||
|
||||
SensorDht::~SensorDht() {}
|
||||
|
||||
void SensorDht::loop() {
|
||||
difference = millis() - prevMillis;
|
||||
if (difference >= interval) {
|
||||
if (difference >= _interval) {
|
||||
prevMillis = millis();
|
||||
readTmpHum();
|
||||
}
|
||||
|
||||
13
src/main.cpp
13
src/main.cpp
@@ -24,8 +24,8 @@
|
||||
#include "items/vLogging.h"
|
||||
#include "items/vSensorAnalog.h"
|
||||
#include "items/vSensorDallas.h"
|
||||
#include "items/vSensorUltrasonic.h"
|
||||
#include "items/vSensorDht.h"
|
||||
#include "items/vSensorUltrasonic.h"
|
||||
|
||||
void not_async_actions();
|
||||
|
||||
@@ -135,10 +135,9 @@ void loop() {
|
||||
mySensorAnalog->at(i).loop();
|
||||
}
|
||||
}
|
||||
//if (mySensorDht != nullptr) {
|
||||
// for (unsigned int i = 0; i < mySensorDht->size(); i++) {
|
||||
// mySensorDht->at(i).loopTmp();
|
||||
// mySensorDht->at(i).loopHum();
|
||||
// }
|
||||
//}
|
||||
if (mySensorDht != nullptr) {
|
||||
for (unsigned int i = 0; i < mySensorDht->size(); i++) {
|
||||
mySensorDht->at(i).loop();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user