mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
dht working
This commit is contained in:
@@ -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