dht working

This commit is contained in:
Dmitry Borisenko
2020-12-24 01:41:15 +01:00
parent 5955743426
commit 99134cb6fd
5 changed files with 19 additions and 26 deletions

View File

@@ -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]*
@@ -22,6 +22,4 @@
0;count-down;id;anydata;Таймер;Обратный#отчет;order* 0;count-down;id;anydata;Таймер;Обратный#отчет;order*
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*

View File

@@ -31,13 +31,12 @@ 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;
}; };
extern MySensorDhtVector* mySensorDht; extern MySensorDhtVector* mySensorDht;
extern void dhtTmp(); extern void dhtSensor();
extern void dhtHum();

View File

@@ -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

View File

@@ -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();
} }

View File

@@ -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(); }
// } }
//}
} }