From a6622975e37b5fdee248efae481261bc7ab878d8 Mon Sep 17 00:00:00 2001 From: huskee Date: Mon, 18 Dec 2023 13:52:43 +0200 Subject: [PATCH] Add WiFiManager --- src/main.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6544ae3..edf476c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -15,6 +16,8 @@ Adafruit_MAX31855 thermocoupleB(CS_B); AsyncWebServer server(80); AsyncWebSocket ws("/ws"); +DNSServer dns; +AsyncWiFiManager wm(&server, &dns); JSONVar readings; @@ -109,13 +112,7 @@ void setup() { } WiFi.mode(WIFI_AP_STA); Serial.printf("wifi init\n"); - WiFi.begin("hackerspace.gr", "hsgrwifi"); - Serial.printf("connecting"); - while (WiFi.status() != WL_CONNECTED) { - Serial.printf("."); - delay(500); - } - Serial.printf(".\n"); + wm.autoConnect("therminator"); Serial.printf("connected! ip addr: "); Serial.println(WiFi.localIP());