fix: single boot refresh with QR code, async WiFi scan, skip light sleep in AP mode

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-03 11:25:41 -04:00
parent abb97c40d8
commit e26671cb2b
6 changed files with 88 additions and 10 deletions

View File

@@ -46,13 +46,24 @@
async function scanNetworks() {
try {
const res = await fetch('/api/wifi/scan');
const networks = await res.json();
const data = await res.json();
if (data.scanning) {
// Scan in progress — retry after 2s
setTimeout(scanNetworks, 2000);
return;
}
const select = document.getElementById('wifiSsid');
select.innerHTML = networks.map(n =>
if (data.length === 0) {
select.innerHTML = '<option value="">No networks found</option>';
setTimeout(scanNetworks, 3000);
return;
}
select.innerHTML = data.map(n =>
`<option value="${n.ssid}">${n.ssid} (${n.rssi}dBm)</option>`
).join('');
} catch (e) {
console.error('Scan failed:', e);
setTimeout(scanNetworks, 3000);
}
}