fix(led): swap WiFi(play)/LAN(wifi+eth), LAN carrier via CLAWD_ETH_IFACE, faster alarm
- WifiLed drives play; LanLed drives wifi+eth pair (matches panel silkscreen) - hasLanCableCarrier(): CLAWD_ETH_IFACE-only carrier when set (reliable unplug) - LAN poll 1s; config.activated persisted for immediate setApps on boot/reconnect - setApps double vfdOn alarm after 50ms for slow OpenVFD - Clear activated + setSetup on credential errors - install.sh env comment for CLAWD_ETH_IFACE Made-with: Cursor
This commit is contained in:
@@ -83,8 +83,11 @@ class ClawClient {
|
||||
async start() {
|
||||
log.info('clawd', `启动中... 服务器 = ${this._cfg.server}`);
|
||||
|
||||
// 启动时全灭,WS 连接后由 _applyStatus() 按实际状态设置
|
||||
// 启动时关 alarm;若本地已记为已激活,立即亮 pwr(不等首包 connected)
|
||||
led.status.off();
|
||||
if (this._cfg.activated) {
|
||||
led.status.setApps();
|
||||
}
|
||||
|
||||
this._startSdNotify();
|
||||
|
||||
@@ -213,6 +216,9 @@ class ClawClient {
|
||||
this._backoff = 1_000;
|
||||
this._wsFailCount = 0; // 连接成功,重置失败计数
|
||||
this._hasEverConnected = true; // 标记已成功连接过
|
||||
if (this._cfg.activated) {
|
||||
led.status.setApps();
|
||||
}
|
||||
this._sendConnect();
|
||||
this._startPing();
|
||||
// 显示由 _onConnected 根据 status 设置,不在此处提前 showTime
|
||||
@@ -332,12 +338,16 @@ class ClawClient {
|
||||
log.warn('clawd', '硬件指纹不符,清除凭证重新注册...');
|
||||
this._cfg.claw_id = null;
|
||||
this._cfg.token = null;
|
||||
this._cfg.activated = false;
|
||||
config.save(this._cfg);
|
||||
led.status.setSetup();
|
||||
} else if (msg.msg && msg.msg.includes('invalid')) {
|
||||
log.warn('clawd', '凭证无效,清除凭证重新注册...');
|
||||
this._cfg.claw_id = null;
|
||||
this._cfg.token = null;
|
||||
this._cfg.activated = false;
|
||||
config.save(this._cfg);
|
||||
led.status.setSetup();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -369,6 +379,8 @@ class ClawClient {
|
||||
|
||||
_applyStatus(msg) {
|
||||
if (msg.status === 'inactive') {
|
||||
this._cfg.activated = false;
|
||||
config.save(this._cfg);
|
||||
led.status.setSetup();
|
||||
led.display.showPin(msg.pin);
|
||||
const id = String(this._cfg.claw_id || '').padEnd(6);
|
||||
@@ -383,6 +395,8 @@ class ClawClient {
|
||||
log.info('clawd', '等待激活,心跳正常运行...');
|
||||
this._updateOpenClawOrigin('0000');
|
||||
} else {
|
||||
this._cfg.activated = true;
|
||||
config.save(this._cfg);
|
||||
led.status.setApps();
|
||||
led.display.showTime();
|
||||
log.info('clawd', `已激活 claw_id = ${this._cfg.claw_id}`);
|
||||
|
||||
Reference in New Issue
Block a user