Commit Graph

32 Commits

Author SHA1 Message Date
a85732aa80 fix: stabilize rk3588 wifi provisioning 2026-05-24 20:37:21 +08:00
306243eb6a fix: align provisioning logic with base devices 2026-05-24 10:07:55 +08:00
161e0e654c feat(rk3588s): unify display state semantics and bump version to 1.4.5 2026-05-23 18:22:13 +08:00
stswangzhiping
c9ce87c93a fix: keep WiFi LED on after STA detection 2026-04-26 18:38:22 +08:00
stswangzhiping
f6aad310a8 fix: improve WiFi AP recovery and scan 2026-04-26 10:57:54 +08:00
stswangzhiping
12aedaaf85 feat(net): late uplink poll + faster provision monitor (15s)
- client: while !_connectionStarted, poll every 3s for hasInternet or
  hasWiredInternetProbe (e.g. Ethernet after AP); start _proceedWithConnection
  once; clear poll on network-ready/stop. Avoids provision-level emit spam.
- provisioning: MONITOR_INTERVAL_MS 30s -> 15s for quicker WiFi/AP UI.

Made-with: Cursor
2026-04-02 12:40:41 +08:00
stswangzhiping
fe62b9febe Revert "fix(provision): emit network-ready when AP mode gains internet (e.g. Ethernet)"
This reverts commit af03410528.
2026-04-02 12:07:40 +08:00
stswangzhiping
af03410528 fix(provision): emit network-ready when AP mode gains internet (e.g. Ethernet)
Monitor previously only closed AP on external WiFi STA; late wired uplink
while in AP never fired network-ready, so WS stayed down and AP display
kept flashing. Poll hasInternet() in AP state and call _emitNetworkReady().

Made-with: Cursor
2026-04-02 11:44:05 +08:00
stswangzhiping
e3e9580e46 fix(network): async connectWifi so systemd watchdog can fire during nmcli wait 2026-03-29 08:14:24 +08:00
stswangzhiping
4c16483ee7 fix(network): robust AP->STA connect (nmcli argv, device show state, wifi iface for DNS) 2026-03-29 07:46:22 +08:00
stswangzhiping
012ad90335 fix(provision): treat WiFi join success by STA state, not internet ping 2026-03-29 07:10:43 +08:00
stswangzhiping
f7c462220e fix(led): map LAN to play icon and WiFi status to wifi+eth pair 2026-03-28 22:39:26 +08:00
stswangzhiping
1910a2fb9f fix(led,provision): AP forces WiFi(play) off; LAN uses carrier+operstate
- Monitor: every tick in ap state led.off() so play never stays on with hotspot
- hasLanCableCarrier: _ifacePhysicalLinkUp (carrier=1 and operstate not down)
- When end0/eth0 exist but link down, return false (no fallback to hasWiredCarrier)
- LAN poll 500ms

Made-with: Cursor
2026-03-28 22:15:48 +08:00
stswangzhiping
837cb8865f feat: BtMonitor 监控 bluetoothctl 状态驱动 BT 指示灯
新增 lib/bt-monitor.js:
- 每 3 秒轮询 bluetoothctl show + hcitool con
- connected(ACL 连接存在)→ 常亮
- scanning/connecting(Discovering: yes)→ 闪烁
- 无 adapter / Powered: no / 静止 → 熄灭

client.js:启动时开启 BtMonitor,stop() 时清理
provisioning.js:移除所有 led.bt 调用,BT 灯统一由 BtMonitor 管理

Made-with: Cursor
2026-03-24 23:14:02 +08:00
stswangzhiping
dcc20e2cad fix: BT 灯仅在搜索热点和连接热点时闪烁
等待 NM 自动重连已保存 WiFi 不属于 BLE 搜索/连接阶段,
该阶段 BT 灯保持熄灭,不再闪烁。

Made-with: Cursor
2026-03-24 23:00:07 +08:00
stswangzhiping
37e93c66eb feat: 添加蓝牙指示灯(b6)控制
led.js: 新增 BtLed 类,路径 /sys/devices/platform/openvfd/attr/b6
  - blink() AP 配网进行中
  - on()    配网成功 / WiFi 已连接
  - off()   蓝牙不工作 / 初始/停止状态

provisioning.js: 各配网状态同步驱动 BT 灯
  - AP 模式 / 等待自动重连 → 闪烁
  - WiFi 连接成功 → 常亮
  - stop() → 熄灭

Made-with: Cursor
2026-03-24 22:58:10 +08:00
stswangzhiping
ffa13b7c81 fix: captive portal 改用 IP 地址 10.42.0.1 替代域名
Made-with: Cursor
2026-03-22 08:04:20 +08:00
stswangzhiping
878f3592bf feat: connect 消息上报 local_ip 和 external_ip
Made-with: Cursor
2026-03-21 08:18:27 +08:00
stswangzhiping
af5248f2a6 fix: emit network-ready immediately when wired internet available, setup AP async
Made-with: Cursor
2026-03-20 08:41:39 +08:00
stswangzhiping
08fa4eefaa feat: skip WS in AP+no-internet, poll every 5s until network available
Made-with: Cursor
2026-03-20 07:43:51 +08:00
stswangzhiping
c13ed3ba6d fix(vfd): use isApMode() instead of hasInternet() to decide AP vs Err0
Made-with: Cursor
2026-03-19 23:45:16 +08:00
stswangzhiping
e36bec8660 refactor(led): startup all-off, AP shows VFD, WS close no VFD change
Made-with: Cursor
2026-03-19 22:08:47 +08:00
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