Skip to content

Commit 11b1da8

Browse files
authored
Update DhtTemperatureAndHumiditySensor.ino
1 parent 922cdaa commit 11b1da8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

examples/DhtTemperatureAndHumiditySensor/DhtTemperatureAndHumiditySensor.ino

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
#define DHTPOWERPIN 8
6464

6565

66-
// Sleep time between sensor updates (in milliseconds) to add to sensor delay (read from sensor data; tipically: 1s)
66+
// Sleep time between sensor updates (in milliseconds) to add to sensor delay (read from sensor data; typically: 1s)
6767
static const uint64_t UPDATE_INTERVAL = 60000;
6868

6969
// Force sending an update of the temperature after n sensor reads, so a controller showing the
@@ -74,13 +74,13 @@ static const uint8_t FORCE_UPDATE_N_READS = 10;
7474

7575
#define CHILD_ID_HUM 0
7676
#define CHILD_ID_TEMP 1
77-
#define CHILD_ID_TEMP_HI 2
77+
#define CHILD_ID_HEATINDEX 2
7878

7979
// Set this offset if the sensors have permanent small offsets to the real temperatures/humidity.
8080
// In Celsius degrees or moisture percent
8181
#define SENSOR_HUM_OFFSET 0 // used for temperature data and heat index computation
8282
#define SENSOR_TEMP_OFFSET 0 // used for humidity data
83-
#define SENSOR_TEMP_HI_OFFSET 0 // used for heat index data
83+
#define SENSOR_HEATINDEX_OFFSET 0 // used for heat index data
8484

8585

8686

@@ -99,13 +99,13 @@ uint8_t nNoUpdates = FORCE_UPDATE_N_READS; // send data on start-up
9999
bool metric = true;
100100
float temperature;
101101
float humidity;
102-
float temperatureHI;
102+
float heatindex;
103103

104104

105105

106106
MyMessage msgHum(CHILD_ID_HUM, V_HUM);
107107
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
108-
MyMessage msgTempHI(CHILD_ID_TEMP_HI, V_TEMP);
108+
MyMessage msgHeatIndex(CHILD_ID_HEATINDEX, V_TEMP);
109109

110110

111111

@@ -153,11 +153,11 @@ void presentation()
153153
// Send the sketch version information to the gateway
154154
sendSketchInfo(SN, SV);
155155
// Register all sensors to gw (they will be created as child devices)
156-
present(CHILD_ID_HUM, S_HUM, "Umidity");
156+
present(CHILD_ID_HUM, S_HUM, "Humidity");
157157
wait(100); //to check: is it needed
158158
present(CHILD_ID_TEMP, S_TEMP, "Temperature");
159159
wait(100); //to check: is it needed
160-
present(CHILD_ID_TEMP_HI, S_TEMP, "Heat Index");
160+
present(CHILD_ID_HEATINDEX, S_TEMP, "Heat Index");
161161
metric = getControllerConfig().isMetric;
162162
}
163163

@@ -245,17 +245,17 @@ void loop()
245245
if (fabs(humidity - lastHum)>=0.05 || fabs(temperature - lastTemp)>=0.05 || nNoUpdates >= FORCE_UPDATE_N_READS) {
246246
lastTemp = temperature;
247247
lastHum = humidity;
248-
temperatureHI = computeHeatIndex(temperature,humidity); //computes Heat Index, in *C
248+
heatindex = computeHeatIndex(temperature,humidity); //computes Heat Index, in *C
249249
nNoUpdates = 0; // Reset no updates counter
250250
#ifdef MY_DEBUG
251251
Serial.print("Heat Index: ");
252-
Serial.print(temperatureHI);
252+
Serial.print(heatindex);
253253
Serial.println(" *C");
254254
#endif
255255

256256
if (!metric) {
257257
temperature = 1.8*temperature+32; //convertion to *F
258-
temperatureHI = 1.8*temperatureHI+32; //convertion to *F
258+
heatindex = 1.8*heatindex+32; //convertion to *F
259259
}
260260

261261
#ifdef MY_DEBUG
@@ -275,9 +275,9 @@ if (fabs(humidity - lastHum)>=0.05 || fabs(temperature - lastTemp)>=0.05 || nNoU
275275
#ifdef MY_DEBUG
276276
wait(100);
277277
Serial.print("Sending HeatIndex: ");
278-
Serial.print(temperatureHI);
278+
Serial.print(heatindex);
279279
#endif
280-
send(msgTempHI.set(temperatureHI + SENSOR_TEMP_HI_OFFSET, 2));
280+
send(msgHeatIndex.set(heatindex + SENSOR_HEATINDEX_OFFSET, 2));
281281

282282
}
283283

0 commit comments

Comments
 (0)