diff --git a/WLAN_Thermometer.ino b/WLAN_Thermometer.ino index b3b80f5..4164e0e 100644 --- a/WLAN_Thermometer.ino +++ b/WLAN_Thermometer.ino @@ -30,6 +30,7 @@ #define WIFI_CONNECT_TIMEOUT 30 #define CFG_PORTAL_TIMEOUT 90 #define DHTTYPE DHT22 +#define FIRST_MIN_MAX 300000 // = 5 min LiquidCrystal_I2C lcd(LCD_I2C_ADDR, LCD_COL, LCD_ROW); looper sched; @@ -195,30 +196,36 @@ void loop() client.print(temp[ACT]); client.println(" °C\n"); client.print("

Minimum: "); - client.print(temp[MIN]); + if (millis() > FIRST_MIN_MAX) + client.print(temp[MIN]); client.println(" °C

\n"); client.print("

Maximum: "); - client.print(temp[MAX]); + if (millis() > FIRST_MIN_MAX) + client.print(temp[MAX]); client.println(" °C

\n"); client.println("

Luftfeuchtigkeit

\n"); client.print("

Aktuell: "); client.print(hum[ACT]); client.println(" %

\n"); client.print("

Minimum: "); - client.print(hum[MIN]); + if (millis() > FIRST_MIN_MAX) + client.print(hum[MIN]); client.println(" %

\n"); client.print("

Maximum: "); - client.print(hum[MAX]); + if (millis() > FIRST_MIN_MAX) + client.print(hum[MAX]); client.println(" %

\n"); client.println("

Gefühlte Temperatur

\n"); client.print("

Aktuell: "); client.print(heat[ACT]); client.println(" °C

\n"); client.print("

Minimum: "); - client.print(heat[MIN]); + if (millis() > FIRST_MIN_MAX) + client.print(heat[MIN]); client.println(" °C

\n"); client.print("

Maximum: "); - client.print(heat[MAX]); + if (millis() > FIRST_MIN_MAX) + client.print(heat[MAX]); client.println(" °C

\n"); DateTimeParts p = DateTime.getParts(); @@ -341,9 +348,11 @@ void show_temperature(void) lcd.print("C"); lcd.setCursor(0, 2); lcd.print("Min: "); - lcd.print(temp[MIN], 1); + if (millis() > FIRST_MIN_MAX) + lcd.print(temp[MIN], 1); lcd.print(" Max: "); - lcd.print(temp[MAX], 1); + if (millis() > FIRST_MIN_MAX) + lcd.print(temp[MAX], 1); lcd.setCursor(0, 3); lcd.print("LF: "); lcd.print(hum[ACT], 1); @@ -392,20 +401,24 @@ bool is_wintertime(time_t t) void get_sensor_data(void) { temp[ACT] = constrain(dht.readTemperature(), -40.0, 80.0); - if (temp[ACT] < temp[MIN]) - temp[MIN] = temp[ACT]; - if (temp[ACT] > temp[MAX]) - temp[MAX] = temp[ACT]; - hum[ACT] = constrain(dht.readHumidity(), 0.0, 100.0); - if (hum[ACT] < hum[MIN]) - hum[MIN] = hum[ACT]; - if (hum[ACT] > hum[MAX]) - hum[MAX] = hum[ACT]; - heat[ACT] = constrain(dht.computeHeatIndex(temp[ACT], hum[ACT], false), -40.0, 80.0); - if (heat[ACT] < heat[MIN]) - heat[MIN] = heat[ACT]; - if (heat[ACT] > heat[MAX]) - heat[MAX] = heat[ACT]; + + if (millis() > FIRST_MIN_MAX) + { + if (temp[ACT] < temp[MIN]) + temp[MIN] = temp[ACT]; + if (temp[ACT] > temp[MAX]) + temp[MAX] = temp[ACT]; + + if (hum[ACT] < hum[MIN]) + hum[MIN] = hum[ACT]; + if (hum[ACT] > hum[MAX]) + hum[MAX] = hum[ACT]; + + if (heat[ACT] < heat[MIN]) + heat[MIN] = heat[ACT]; + if (heat[ACT] > heat[MAX]) + heat[MAX] = heat[ACT]; + } }