diff --git a/README.md b/README.md index 31f40a6..45d5c35 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ display). Connect a phone or computer to it - the setup page opens by itself, as WiFi, otherwise open `http://192.168.4.1/`. There, pick a network from the list, enter password, receiver address, optionally device key and web password, and save. The stick restarts and is then reachable on the home network at `http://scanstick-XXXX.local/`. +For a network the stick already knows, an empty password field keeps the stored one. Further networks can be added or removed later in the Settings. **The second way: a file on the card.** For this too **no card reader is needed** - the diff --git a/firmware/scanner/scanner.ino b/firmware/scanner/scanner.ino index 77935de..1c2ec4e 100644 --- a/firmware/scanner/scanner.ino +++ b/firmware/scanner/scanner.ino @@ -362,7 +362,7 @@ static volatile uint32_t g_bytesGeschrieben = 0; // since the last processing static uint32_t g_naechsterVersuch = 0; // 0 = due immediately static int g_versuche = 0; -#define FW_VERSION "v40" +#define FW_VERSION "v41" String cfgEndpoint; // Known WiFi networks - several, so the same stick runs at different locations. @@ -1734,7 +1734,11 @@ static uint32_t g_wlanVerloren = 0; // since when without a network (0 = conne static void wlanStarten() { if (!cfgNetze) { logZeile("[wifi] no network known"); return; } - WiFi.mode(WIFI_STA); + // In setup mode the own access point is running (AP+STA). Switching to + // plain STA here killed it: the two-minute search for known networks + // took the setup Wi-Fi down and nothing turned it on again - the display + // said WIFI SETUP, but the phone no longer saw the network (21.09.2026). + if (WiFi.getMode() != WIFI_AP_STA) WiFi.mode(WIFI_STA); WiFi.setHostname(geraeteName().c_str()); g_wifiMulti.APlistClean(); for (int i = 0; i < cfgNetze; i++) g_wifiMulti.addAP(cfgNetzSsid[i].c_str(), cfgNetzPass[i].c_str()); @@ -2541,9 +2545,15 @@ static void webEinrichten() if (ssid.length()) { int vorhanden = -1; for (int i = 0; i < cfgNetze; i++) if (cfgNetzSsid[i] == ssid) vorhanden = i; - if (vorhanden >= 0) cfgNetzPass[vorhanden] = pass; - else { - if (cfgNetze >= MAX_NETZE) cfgNetze = MAX_NETZE - 1; // oldest one drops out + if (vorhanden >= 0) { + // Empty password = keep the stored one. Before, choosing a known + // network and leaving the field empty saved it WITHOUT a password. + if (pass.length()) cfgNetzPass[vorhanden] = pass; + } else { + if (cfgNetze >= MAX_NETZE) { // oldest one drops out + for (int i = 1; i < MAX_NETZE; i++) { cfgNetzSsid[i - 1] = cfgNetzSsid[i]; cfgNetzPass[i - 1] = cfgNetzPass[i]; } + cfgNetze = MAX_NETZE - 1; + } cfgNetzSsid[cfgNetze] = ssid; cfgNetzPass[cfgNetze] = pass; cfgNetze++; } } @@ -2573,7 +2583,7 @@ static void webEinrichten() h += "
"; h += ""; h += ""; - h += ""; + h += ""; h += ""; h += String("
Networks found
or network name by hand
Wi-Fi password
Wi-Fi password
known network: empty = keep the stored one
Upload target
address of the receiver
Device key
optional, same as SCAN_KEY on the receiver