Commit Graph

10 Commits

Author SHA1 Message Date
stswangzhiping
959a2b67f2 refactor(display): tie VFD display to WS connection state only
Made-with: Cursor
2026-03-18 21:17:36 +08:00
stswangzhiping
9da4cd0aa1 feat: VFD display shows AP when disconnected, time when connected
Made-with: Cursor
2026-03-18 21:10:14 +08:00
stswangzhiping
a0f767f267 fix(led): swap SETUP/APPS paths, WiFi LED off in AP mode
Made-with: Cursor
2026-03-18 20:56:49 +08:00
stswangzhiping
b95e909d48 fix(led): use log.info for LED state, show write errors and hasInternet failures
Made-with: Cursor
2026-03-18 20:07:31 +08:00
stswangzhiping
875e69a454 feat: add WiFi LED indicator (openvfd b5)
Made-with: Cursor
2026-03-18 19:47:20 +08:00
stswangzhiping
c6f55c8c15 fix: pre-scan WiFi before entering AP mode
wlan0 cannot scan while in AP mode (hardware limitation).
Now scan nearby networks before starting hotspot and cache
the results for the captive portal page.

Made-with: Cursor
2026-03-16 13:04:00 +08:00
stswangzhiping
9d8af52bf4 fix: stop killing NM's dnsmasq - use dnsmasq-shared.d instead
Killing all dnsmasq processes caused NetworkManager to detect its
hotspot dnsmasq died and tear down the hotspot (AP appears briefly
then disappears).

Now leverage NM's built-in dnsmasq-shared.d config directory:
write DNS hijack config before starting AP so NM's own dnsmasq
picks it up. No separate dnsmasq process needed.

Made-with: Cursor
2026-03-16 12:40:19 +08:00
stswangzhiping
f58db93b64 fix: wait for NM auto-reconnect before starting AP on reboot
After WiFi is configured and device reboots, NetworkManager needs
a few seconds to auto-connect to saved WiFi. Without waiting,
AP starts immediately and occupies wlan0, preventing NM reconnect.

- Add hasSavedWifiConnection() to check for saved WiFi profiles
- Wait up to 20s for NM auto-connect before falling back to AP
- First boot (no saved WiFi) still starts AP immediately

Made-with: Cursor
2026-03-16 12:27:25 +08:00
stswangzhiping
b42e59fab8 feat: AP always-on mode - hotspot stays until WiFi STA connects
Redesign provisioning from one-shot blocking to persistent background manager:
- AP hotspot starts at boot regardless of eth0 status
- Captive portal runs alongside AP for WiFi configuration
- AP automatically shuts down only when WiFi STA connects
- WiFi drops at runtime -> AP auto-restarts
- WiFi connect fails -> AP auto-restarts for retry
- client.js no longer blocks on network; connects WS when ready

Made-with: Cursor
2026-03-16 12:18:35 +08:00
stswangzhiping
eb9f4ab1c3 feat: add WiFi provisioning for headless devices (AP + Captive Portal)
- Add lib/network.js: WiFi scan, connect, AP hotspot via nmcli
- Add lib/dns-hijack.js: dnsmasq management for DNS hijack + DHCP
- Add lib/captive-server.js: embedded HTTP captive portal with WiFi setup page
- Add lib/provisioning.js: orchestrator (detect network -> AP mode -> wait -> exit)
- Update client.js: call ensureNetwork() before WS connection
- Update install.sh: auto-install dnsmasq dependency

Made-with: Cursor
2026-03-16 08:58:51 +08:00