From dc1ad1d1e1cf3d6a9f41f062186fc4b0e2d04021 Mon Sep 17 00:00:00 2001
From: user2684 <you@example.com>
Date: Tue, 4 Apr 2017 14:51:48 +0200
Subject: [PATCH] DHT object is always initialized to DHT22 #39

---
 NodeManager.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NodeManager.cpp b/NodeManager.cpp
index d2ff380..05e99ea 100644
--- a/NodeManager.cpp
+++ b/NodeManager.cpp
@@ -1080,8 +1080,8 @@ int NodeManager::registerSensor(int sensor_type, int pin, int child_id) {
   #endif
   #if MODULE_DHT == 1
     else if (sensor_type == SENSOR_DHT11 || sensor_type == SENSOR_DHT22) {
-      DHT* dht = new DHT(pin,DHT22);
       int dht_type = sensor_type == SENSOR_DHT11 ? DHT11 : DHT22;
+      DHT* dht = new DHT(pin,dht_type);
       registerSensor(new SensorDHT(child_id,pin,dht,0,dht_type));
       child_id = _getAvailableChildId();
       return registerSensor(new SensorDHT(child_id,pin,dht,1,dht_type));
-- 
GitLab