refactor(display): tie VFD display to WS connection state only

Made-with: Cursor
This commit is contained in:
stswangzhiping
2026-03-18 21:17:36 +08:00
parent a737101c2e
commit 959a2b67f2
2 changed files with 7 additions and 11 deletions

View File

@@ -131,6 +131,7 @@ class ClawClient {
this._backoff = 1_000;
this._sendConnect();
this._startPing();
led.display.showTime(); // 连上云端 → 显示时间
});
ws.on('message', (data) => {
@@ -150,6 +151,7 @@ class ClawClient {
this._clearPing();
if (!this._stopped) {
log.warn('clawd', `连接断开 (${code})${this._backoff / 1000}s 后重连...`);
led.display.showAP(); // 断开云端 → 显示 AP
setTimeout(() => this._connect(), this._backoff);
this._backoff = Math.min(this._backoff * 2, MAX_BACKOFF_MS);
}