fix(vfd): use isApMode() instead of hasInternet() to decide AP vs Err0
Made-with: Cursor
This commit is contained in:
@@ -163,10 +163,11 @@ class ClawClient {
|
||||
this._wsFailCount++;
|
||||
log.warn('clawd', `连接断开 (${code}),失败次数=${this._wsFailCount},${this._backoff / 1000}s 后重连...`);
|
||||
if (this._hasEverConnected && this._wsFailCount >= 3) {
|
||||
if (hasInternet()) {
|
||||
led.display.showErr0(); // 有网但 VPS 不可达
|
||||
const inAp = this._provisionMgr && this._provisionMgr.isApMode();
|
||||
if (inAp || !hasInternet()) {
|
||||
led.display.showAP(); // AP 模式 或 无网
|
||||
} else {
|
||||
led.display.showAP(); // 无网,AP 模式
|
||||
led.display.showErr0(); // STA 模式 + 有网 但 VPS 不可达
|
||||
}
|
||||
}
|
||||
setTimeout(() => this._connect(), this._backoff);
|
||||
|
||||
@@ -31,6 +31,9 @@ class ProvisionManager extends EventEmitter {
|
||||
this._monitorTimer = null;
|
||||
}
|
||||
|
||||
/** 是否正处于 AP 模式(WiFi 热点广播中) */
|
||||
isApMode() { return this._state === 'ap'; }
|
||||
|
||||
async start() {
|
||||
led.off(); // 初始状态:灭灯
|
||||
|
||||
|
||||
Reference in New Issue
Block a user