1111 SOURCE: https://github.com/sensate-io/firmware-esp8266.git
1212
1313 @section HISTORY
14+ v31 - Fixed an issue with DHT11 Sensors
1415 v29 - First Public Release
1516*/
1617/* *************************************************************************/
@@ -73,7 +74,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
7374 {
7475 if (!initDHT0)
7576 {
76- portFix (port);
77+ if (type!=DHT11)
78+ portFix (port);
7779 initDHT0=true ;
7880 dht0 = new DHT_Unified (0 , type);
7981 dht0->begin ();
@@ -84,7 +86,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
8486 {
8587 if (!initDHT1)
8688 {
87- portFix (port);
89+ if (type!=DHT11)
90+ portFix (port);
8891 initDHT1=true ;
8992 dht1 = new DHT_Unified (1 , type);
9093 dht1->begin ();
@@ -95,7 +98,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
9598 {
9699 if (!initDHT2)
97100 {
98- portFix (port);
101+ if (type!=DHT11)
102+ portFix (port);
99103 initDHT2=true ;
100104 dht2 = new DHT_Unified (2 , type);
101105 dht2->begin ();
@@ -106,7 +110,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
106110 {
107111 if (!initDHT3)
108112 {
109- portFix (port);
113+ if (type!=DHT11)
114+ portFix (port);
110115 initDHT3=true ;
111116 dht3 = new DHT_Unified (3 , type);
112117 dht3->begin ();
@@ -120,7 +125,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
120125 {
121126 if (!initDHT4)
122127 {
123- portFix (port);
128+ if (type!=DHT11)
129+ portFix (port);
124130 initDHT4=true ;
125131 dht4 = new DHT_Unified (4 , type);
126132 dht4->begin ();
@@ -131,7 +137,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
131137 {
132138 if (!initDHT5)
133139 {
134- portFix (port);
140+ if (type!=DHT11)
141+ portFix (port);
135142 initDHT5=true ;
136143 dht5 = new DHT_Unified (5 , type);
137144 dht5->begin ();
@@ -145,7 +152,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
145152 {
146153 if (!initDHT6)
147154 {
148- portFix (port);
155+ if (type!=DHT11)
156+ portFix (port);
149157 initDHT6=true ;
150158 dht6 = new DHT_Unified (6 , type);
151159 dht6->begin ();
@@ -156,7 +164,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
156164 {
157165 if (!initDHT7)
158166 {
159- portFix (port);
167+ if (type!=DHT11)
168+ portFix (port);
160169 initDHT7=true ;
161170 dht7 = new DHT_Unified (7 , type);
162171 dht7->begin ();
@@ -167,7 +176,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
167176 {
168177 if (!initDHT8)
169178 {
170- portFix (port);
179+ if (type!=DHT11)
180+ portFix (port);
171181 initDHT8=true ;
172182 dht8 = new DHT_Unified (8 , type);
173183 dht8->begin ();
@@ -178,7 +188,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
178188 {
179189 if (!initDHT9)
180190 {
181- portFix (port);
191+ if (type!=DHT11)
192+ portFix (port);
182193 initDHT9=true ;
183194 dht9 = new DHT_Unified (9 , type);
184195 dht9->begin ();
@@ -192,7 +203,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
192203 {
193204 if (!initDHT10)
194205 {
195- portFix (port);
206+ if (type!=DHT11)
207+ portFix (port);
196208 initDHT10=true ;
197209 dht10 = new DHT_Unified (10 , type);
198210 dht10->begin ();
@@ -203,7 +215,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
203215 {
204216 if (!initDHT11)
205217 {
206- portFix (port);
218+ if (type!=DHT11)
219+ portFix (port);
207220 initDHT11=true ;
208221 dht11 = new DHT_Unified (11 , type);
209222 dht11->begin ();
@@ -214,7 +227,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
214227 {
215228 if (!initDHT12)
216229 {
217- portFix (port);
230+ if (type!=DHT11)
231+ portFix (port);
218232 initDHT12=true ;
219233 dht12 = new DHT_Unified (12 , type);
220234 dht12->begin ();
@@ -225,7 +239,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
225239 {
226240 if (!initDHT13)
227241 {
228- portFix (port);
242+ if (type!=DHT11)
243+ portFix (port);
229244 initDHT13=true ;
230245 dht13 = new DHT_Unified (13 , type);
231246 dht13->begin ();
@@ -236,7 +251,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
236251 {
237252 if (!initDHT14)
238253 {
239- portFix (port);
254+ if (type!=DHT11)
255+ portFix (port);
240256 initDHT14=true ;
241257 dht14 = new DHT_Unified (14 , type);
242258 dht14->begin ();
@@ -247,7 +263,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
247263 {
248264 if (!initDHT15)
249265 {
250- portFix (port);
266+ if (type!=DHT11)
267+ portFix (port);
251268 initDHT15=true ;
252269 dht15 = new DHT_Unified (15 , type);
253270 dht15->begin ();
@@ -258,7 +275,8 @@ SensorDHT::SensorDHT (long id, String dhtType, String shortName, String name, ui
258275 {
259276 if (!initDHT16)
260277 {
261- portFix (port);
278+ if (type!=DHT11)
279+ portFix (port);
262280 initDHT16=true ;
263281 dht16 = new DHT_Unified (16 , type);
264282 dht16->begin ();
0 commit comments