mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 20:09:14 +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;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;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;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;dhtTmp;anydataTemp;Сенсоры;Температура;1;pin[2];type[dht11];c[1];int[10]
|
||||||
0;dht-hum;id;anydataHum;Сенсоры;Влажность;order;pin[2];type[dht11];c[1];int[10]*
|
0;dht;dhtHum;anydataHum;Сенсоры;Влажность;2;pin[2];type[dht11];c[1];int[10]*
|
||||||
0;dht-temp;id;anydataTemp;Сенсоры;Температура;order;pin[2];type[dht22];c[1];int[10]
|
0;dht;dhtTmp;anydataTemp;Сенсоры;Температура;1;pin[2];type[dht22];c[1];int[10]
|
||||||
0;dht-hum;id;anydataHum;Сенсоры;Влажность;order;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-temp;id;anydataTemp;Сенсоры;Температура;order;addr[0x76];c[1]
|
||||||
0;bme280-hum;id;anydataHum;Сенсоры;Влажность;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]*
|
0;bme280-press;id;anydataPress;Сенсоры;Давление;order;addr[0x76];c[1]*
|
||||||
@@ -23,5 +23,3 @@
|
|||||||
0;inoutput;id;anydata;Вывод;Вывод#uart;order*
|
0;inoutput;id;anydata;Вывод;Вывод#uart;order*
|
||||||
0;logging;id;chart;Графики;История;order;val[any];int[60];cnt[100]*
|
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,7 +31,7 @@ class SensorDht {
|
|||||||
params _paramsTmp;
|
params _paramsTmp;
|
||||||
params _paramsHum;
|
params _paramsHum;
|
||||||
|
|
||||||
unsigned int interval;
|
unsigned int _interval;
|
||||||
|
|
||||||
unsigned long prevMillis;
|
unsigned long prevMillis;
|
||||||
unsigned long difference;
|
unsigned long difference;
|
||||||
@@ -39,5 +39,4 @@ class SensorDht {
|
|||||||
|
|
||||||
extern MySensorDhtVector* mySensorDht;
|
extern MySensorDhtVector* mySensorDht;
|
||||||
|
|
||||||
extern void dhtTmp();
|
extern void dhtSensor();
|
||||||
extern void dhtHum();
|
|
||||||
@@ -74,11 +74,8 @@ void csvCmdExecute(String& cmdStr) {
|
|||||||
sCmd.addCommand(order.c_str(), dallas);
|
sCmd.addCommand(order.c_str(), dallas);
|
||||||
}
|
}
|
||||||
#ifdef SensorDhtEnabled
|
#ifdef SensorDhtEnabled
|
||||||
else if (order == F("dht-temp")) {
|
else if (order == F("dht")) {
|
||||||
//sCmd.addCommand(order.c_str(), dhtTmp);
|
sCmd.addCommand(order.c_str(), dhtSensor);
|
||||||
}
|
|
||||||
else if (order == F("dht-hum")) {
|
|
||||||
//sCmd.addCommand(order.c_str(), dhtHum);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef SensorBme280Enabled
|
#ifdef SensorBme280Enabled
|
||||||
|
|||||||
@@ -18,15 +18,15 @@ SensorDht::SensorDht(const params& paramsTmp, const params& paramsHum) {
|
|||||||
|
|
||||||
dht->setup(_paramsTmp.pin, DHTesp::DHT11);
|
dht->setup(_paramsTmp.pin, DHTesp::DHT11);
|
||||||
|
|
||||||
interval = _paramsTmp.interval < _paramsHum.interval ? _paramsTmp.interval : _paramsHum.interval;
|
_interval = _paramsTmp.interval < _paramsHum.interval ? _paramsTmp.interval : _paramsHum.interval;
|
||||||
interval = interval + dht->getMinimumSamplingPeriod();
|
_interval = _interval + dht->getMinimumSamplingPeriod();
|
||||||
}
|
}
|
||||||
|
|
||||||
SensorDht::~SensorDht() {}
|
SensorDht::~SensorDht() {}
|
||||||
|
|
||||||
void SensorDht::loop() {
|
void SensorDht::loop() {
|
||||||
difference = millis() - prevMillis;
|
difference = millis() - prevMillis;
|
||||||
if (difference >= interval) {
|
if (difference >= _interval) {
|
||||||
prevMillis = millis();
|
prevMillis = millis();
|
||||||
readTmpHum();
|
readTmpHum();
|
||||||
}
|
}
|
||||||
|
|||||||
13
src/main.cpp
13
src/main.cpp
@@ -24,8 +24,8 @@
|
|||||||
#include "items/vLogging.h"
|
#include "items/vLogging.h"
|
||||||
#include "items/vSensorAnalog.h"
|
#include "items/vSensorAnalog.h"
|
||||||
#include "items/vSensorDallas.h"
|
#include "items/vSensorDallas.h"
|
||||||
#include "items/vSensorUltrasonic.h"
|
|
||||||
#include "items/vSensorDht.h"
|
#include "items/vSensorDht.h"
|
||||||
|
#include "items/vSensorUltrasonic.h"
|
||||||
|
|
||||||
void not_async_actions();
|
void not_async_actions();
|
||||||
|
|
||||||
@@ -135,10 +135,9 @@ void loop() {
|
|||||||
mySensorAnalog->at(i).loop();
|
mySensorAnalog->at(i).loop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if (mySensorDht != nullptr) {
|
if (mySensorDht != nullptr) {
|
||||||
// for (unsigned int i = 0; i < mySensorDht->size(); i++) {
|
for (unsigned int i = 0; i < mySensorDht->size(); i++) {
|
||||||
// mySensorDht->at(i).loopTmp();
|
mySensorDht->at(i).loop();
|
||||||
// mySensorDht->at(i).loopHum();
|
}
|
||||||
// }
|
}
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user