fix(led): swap SETUP/APPS paths, WiFi LED off in AP mode

Made-with: Cursor
This commit is contained in:
stswangzhiping
2026-03-18 20:56:49 +08:00
parent 90bba5f348
commit a0f767f267
2 changed files with 7 additions and 5 deletions

View File

@@ -69,10 +69,11 @@ class ProvisionManager extends EventEmitter {
_emitNetworkReady() {
if (hasInternet()) {
led.on(); // 网络畅通 → 常亮
// WiFi 灯只在 STA 模式下亮(有线有网而 WiFi 在 AP 模式时不亮)
if (this._state === 'sta') led.on();
this.emit('network-ready');
} else {
log.warn('provision', 'WiFi 已连接但 hasInternet() 返回 falseLED 保持熄灭');
log.warn('provision', 'hasInternet() 返回 falseLED 保持熄灭');
}
}
@@ -183,7 +184,7 @@ class ProvisionManager extends EventEmitter {
this.emit('network-ready');
}
// STA 模式下持续监测互联网连通性,实时更新 LED
// WiFi 灯:只在 STA 模式下反映互联网连通性AP 模式下始终熄灭
if (this._state === 'sta') {
if (hasInternet()) {
led.on();
@@ -191,6 +192,7 @@ class ProvisionManager extends EventEmitter {
led.off(); // WiFi 已连接但无互联网
}
}
// AP 模式下 led 已在 _enterAP() 中熄灭,无需重复操作
}, MONITOR_INTERVAL_MS);
}