Some small fixes.

master
Holger Wirtz 4 years ago
parent d18255dd69
commit a1c052308a
  1. 17
      WLAN_Thermometer.ino

@ -1,6 +1,6 @@
// Use from 0 to 4. Higher number, more debugging messages and memory usage. // Use from 0 to 4. Higher number, more debugging messages and memory usage.
//#define _WIFIMGR_LOGLEVEL_ 4 //#define _WIFIMGR_LOGLEVEL_ 4
#define DEBUG 1 //#define DEBUG 1
#include <WiFi.h> #include <WiFi.h>
#include <WiFiManager.h> #include <WiFiManager.h>
@ -81,7 +81,7 @@ void setup()
{ {
ap_data_reset(); ap_data_reset();
} }
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
WiFiManager wm; WiFiManager wm;
@ -122,7 +122,7 @@ void setup()
DEBUG_MSG("mDNS started.\n"); DEBUG_MSG("mDNS started.\n");
} }
lcd.setCursor(0,2); lcd.setCursor(0, 2);
lcd.print(F("Mode WiFi client")); lcd.print(F("Mode WiFi client"));
lcd.setCursor(0, 3); lcd.setCursor(0, 3);
lcd.print(WiFi.localIP()); lcd.print(WiFi.localIP());
@ -485,7 +485,10 @@ void get_sensor_data(void)
{ {
temp[ACT] = dht.readTemperature(); temp[ACT] = dht.readTemperature();
hum[ACT] = dht.readHumidity(); hum[ACT] = dht.readHumidity();
heat[ACT] = dht.computeHeatIndex(temp[ACT], hum[ACT], false); if (!isnan(temp[ACT]) && !isnan(hum[ACT]))
heat[ACT] = dht.computeHeatIndex(temp[ACT], hum[ACT], false);
else
heat[ACT] = NAN;
if (minmax_enabled == false && millis() > FIRST_MIN_MAX) if (minmax_enabled == false && millis() > FIRST_MIN_MAX)
{ {
@ -517,7 +520,7 @@ void get_sensor_data(void)
{ {
if (temp[ACT] < temp[MIN]) if (temp[ACT] < temp[MIN])
temp[MIN] = temp[ACT]; temp[MIN] = temp[ACT];
if (temp[ACT] > temp[MAX]) else if (temp[ACT] > temp[MAX])
temp[MAX] = temp[ACT]; temp[MAX] = temp[ACT];
} }
@ -525,7 +528,7 @@ void get_sensor_data(void)
{ {
if (hum[ACT] < hum[MIN]) if (hum[ACT] < hum[MIN])
hum[MIN] = hum[ACT]; hum[MIN] = hum[ACT];
if (hum[ACT] > hum[MAX]) else if (hum[ACT] > hum[MAX])
hum[MAX] = hum[ACT]; hum[MAX] = hum[ACT];
} }
@ -533,7 +536,7 @@ void get_sensor_data(void)
{ {
if (heat[ACT] < heat[MIN]) if (heat[ACT] < heat[MIN])
heat[MIN] = heat[ACT]; heat[MIN] = heat[ACT];
if (heat[ACT] > heat[MAX]) else if (heat[ACT] > heat[MAX])
heat[MAX] = heat[ACT]; heat[MAX] = heat[ACT];
} }
} }

Loading…
Cancel
Save