diff --git a/ESP32_AP-Flasher/src/wifimanager.cpp b/ESP32_AP-Flasher/src/wifimanager.cpp index 37fd0900..6a5d7214 100644 --- a/ESP32_AP-Flasher/src/wifimanager.cpp +++ b/ESP32_AP-Flasher/src/wifimanager.cpp @@ -10,6 +10,7 @@ #include "udp.h" #include "web.h" #include "ips_display.h" +#include "tag_db.h" uint8_t WifiManager::apClients = 0; uint8_t x_buffer[100]; @@ -103,8 +104,23 @@ bool WifiManager::connectToWifi(String ssid, String pass, bool savewhensuccessfu _APstarted = false; WiFi.disconnect(false, true); + WiFi.mode(WIFI_MODE_NULL); + char hostname[32] = "OpenEpaperLink-AP\0"; + if (config.alias[0] != '\0') { + int len = strlen(config.alias); + int j = 0; + for (int i = 0; i < len; i++) { + char c = config.alias[i]; + if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '-') { + hostname[j] = c; + j++; + } + } + hostname[j] = '\0'; + } + WiFi.setHostname(hostname); WiFi.mode(WIFI_STA); - WiFi.setSleep(WIFI_PS_NONE); + WiFi.setSleep(WIFI_PS_MIN_MODEM); terminalLog("Connecting to WiFi..."); logLine("Connecting to WiFi..."); diff --git a/ESP32_AP-Flasher/wwwroot/index.html b/ESP32_AP-Flasher/wwwroot/index.html index 02c93df7..364bb9da 100644 --- a/ESP32_AP-Flasher/wwwroot/index.html +++ b/ESP32_AP-Flasher/wwwroot/index.html @@ -244,7 +244,7 @@ to save file system space">
loading
AP config
-
file system
+
File System