Autorestart if connection fails.

master
Holger Wirtz 4 years ago
parent b8d35e108e
commit e666161ef7
  1. 25
      WLAN_Thermometer.ino

@ -53,6 +53,9 @@ enum {
MAX MAX
}; };
void ConfigAPWeb(void);
void ConfigAPStarted(WiFiManager* wm);
void setup() void setup()
{ {
pinMode(AP_DATA_RESET_PIN, INPUT_PULLDOWN); pinMode(AP_DATA_RESET_PIN, INPUT_PULLDOWN);
@ -76,12 +79,15 @@ void setup()
lcd.setCursor(0, 2); lcd.setCursor(0, 2);
lcd.print(F("Connecting WiFi... ")); lcd.print(F("Connecting WiFi... "));
lcd.setCursor(0, 3);
lcd.print(F("CFG-AP: 192.168.4.1"));
wm.setWebServerCallback(ConfigAPWeb);
wm.setAPCallback(ConfigAPStarted);
wm.setConnectTimeout(WIFI_CONNECT_TIMEOUT); wm.setConnectTimeout(WIFI_CONNECT_TIMEOUT);
wm.setConfigPortalTimeout(CFG_PORTAL_TIMEOUT); wm.setConfigPortalTimeout(CFG_PORTAL_TIMEOUT);
wm.setBreakAfterConfig(true); wm.setBreakAfterConfig(true);
wm.setRemoveDuplicateAPs(true);
wm.setWiFiAutoReconnect(false);
wm.setEnableConfigPortal(false);
if (!wm.autoConnect(AP_SSID_CONFIG_NAME, AP_CONFIG_PASSWORD)) if (!wm.autoConnect(AP_SSID_CONFIG_NAME, AP_CONFIG_PASSWORD))
{ {
@ -497,3 +503,18 @@ void get_sensor_data(void)
} }
} }
} }
void ConfigAPWeb(void)
{
lcd.clear();
lcd.setCursor(0, 2);
lcd.print(F("Mode Config-AP"));
lcd.setCursor(0, 3);
lcd.print(F("192.168.4.1"));
}
void ConfigAPStarted(WiFiManager * wm)
{
lcd.clear();
DEBUG_MSG("Config-AP started\n");
}

Loading…
Cancel
Save