Skip to content

Commit d9b871d

Browse files
author
g0r3
committed
add ap password; reboot after no reconnect
1 parent d8144fb commit d9b871d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

thermometer/thermometer.ino

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,19 @@ WiFiServer server(80);
4242
void setup() {
4343
write_header("setup()");
4444
Serial.begin(115200);
45+
WiFi.hostname("ESP8266-Weatherstation");
4546
EEPROM.begin(city_len + countrycode_len + apikey_len);
4647
setup_display(update_display_clock);
4748
WiFiManager wifiManager;
48-
WiFi.hostname("ESP8266-Weatherstation");
49-
wifiManager.autoConnect("AutoConnectAP");
49+
wifiManager.setTimeout(60);
50+
51+
if(!wifiManager.autoConnect("AutoConnectAP", "diesistdaspasswort")) {
52+
Serial.println("failed to connect and hit timeout");
53+
delay(3000);
54+
//reset and try again, or maybe put it to deep sleep
55+
ESP.restart();
56+
}
57+
5058
Serial.println("Connected.");
5159
ipaddress = WiFi.localIP().toString();
5260
read_config_from_storage();

0 commit comments

Comments
 (0)