feat(wifi): scan, connect and persist networks from the settings app

Adds a wifi binding over the Arduino API and a settings flow that scans, picks
the strongest AP per SSID, takes a password from an on-screen keyboard, and
reports connection state. Credentials join /settings.lua and reconnect at boot.

Settings are now written through a temp file and rename, and strings are
Lua-escaped, so a password cannot corrupt the file the firmware parses at boot.
This commit is contained in:
2026-08-01 06:29:38 -04:00
parent 4e5796fd51
commit eec9b692c6
8 changed files with 357 additions and 25 deletions
+6
View File
@@ -1,6 +1,7 @@
#include <SD.h>
#include <SPI.h>
#include <TFT_eSPI.h>
#include <WiFi.h>
#include <XPT2046_Touchscreen.h>
#include "lua/lua_app.h"
@@ -58,6 +59,11 @@ void setup() {
return;
}
settings.load(); // absent file keeps the built-in defaults
WiFi.persistent(false);
if (settings.wifiSsid.length()) {
WiFi.mode(WIFI_STA);
WiFi.begin(settings.wifiSsid.c_str(), settings.wifiPassword.c_str());
}
startApp(LAUNCHER);
}