|
|
|
@ -442,36 +442,58 @@ bool is_wintertime(time_t t) |
|
|
|
|
|
|
|
|
|
void get_sensor_data(void) |
|
|
|
|
{ |
|
|
|
|
temp[ACT] = constrain(dht.readTemperature(), -40.0, 80.0); |
|
|
|
|
hum[ACT] = constrain(dht.readHumidity(), 0.0, 100.0); |
|
|
|
|
heat[ACT] = constrain(dht.computeHeatIndex(temp[ACT], hum[ACT], false), -40.0, 80.0); |
|
|
|
|
temp[ACT] = dht.readTemperature(); |
|
|
|
|
hum[ACT] = dht.readHumidity(); |
|
|
|
|
heat[ACT] = dht.computeHeatIndex(temp[ACT], hum[ACT], false); |
|
|
|
|
|
|
|
|
|
if (minmax_enabled == false && millis() > FIRST_MIN_MAX) |
|
|
|
|
{ |
|
|
|
|
minmax_enabled = true; |
|
|
|
|
temp[MIN] = temp[ACT]; |
|
|
|
|
temp[MAX] = temp[ACT]; |
|
|
|
|
hum[MIN] = hum[ACT]; |
|
|
|
|
hum[MAX] = hum[ACT]; |
|
|
|
|
heat[MIN] = heat[ACT]; |
|
|
|
|
heat[MIN] = heat[ACT]; |
|
|
|
|
} |
|
|
|
|
if (!isnan(temp[ACT]) && !isnan(hum[ACT]) && !isnan(heat[ACT])) |
|
|
|
|
minmax_enabled = true; |
|
|
|
|
|
|
|
|
|
if (minmax_enabled == true) |
|
|
|
|
{ |
|
|
|
|
if (temp[ACT] < temp[MIN]) |
|
|
|
|
if (!isnan(temp[ACT])) |
|
|
|
|
{ |
|
|
|
|
temp[MIN] = temp[ACT]; |
|
|
|
|
if (temp[ACT] > temp[MAX]) |
|
|
|
|
temp[MAX] = temp[ACT]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (hum[ACT] < hum[MIN]) |
|
|
|
|
if (!isnan(hum[ACT])) |
|
|
|
|
{ |
|
|
|
|
hum[MIN] = hum[ACT]; |
|
|
|
|
if (hum[ACT] > hum[MAX]) |
|
|
|
|
hum[MAX] = hum[ACT]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (heat[ACT] < heat[MIN]) |
|
|
|
|
if (!isnan(heat[ACT])) |
|
|
|
|
{ |
|
|
|
|
heat[MIN] = heat[ACT]; |
|
|
|
|
heat[MIN] = heat[ACT]; |
|
|
|
|
if (heat[ACT] > heat[MAX]) |
|
|
|
|
heat[MAX] = heat[ACT]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (minmax_enabled == true) |
|
|
|
|
{ |
|
|
|
|
if (!isnan(temp[ACT])) |
|
|
|
|
{ |
|
|
|
|
if (temp[ACT] < temp[MIN]) |
|
|
|
|
temp[MIN] = temp[ACT]; |
|
|
|
|
if (temp[ACT] > temp[MAX]) |
|
|
|
|
temp[MAX] = temp[ACT]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!isnan(hum[ACT])) |
|
|
|
|
{ |
|
|
|
|
if (hum[ACT] < hum[MIN]) |
|
|
|
|
hum[MIN] = hum[ACT]; |
|
|
|
|
if (hum[ACT] > hum[MAX]) |
|
|
|
|
hum[MAX] = hum[ACT]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!isnan(heat[ACT])) |
|
|
|
|
{ |
|
|
|
|
if (heat[ACT] < heat[MIN]) |
|
|
|
|
heat[MIN] = heat[ACT]; |
|
|
|
|
if (heat[ACT] > heat[MAX]) |
|
|
|
|
heat[MAX] = heat[ACT]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|