fix(led): map LAN to play icon and WiFi status to wifi+eth pair

This commit is contained in:
stswangzhiping
2026-03-28 22:39:26 +08:00
parent ea502fc26a
commit f7c462220e
2 changed files with 11 additions and 12 deletions

View File

@@ -7,9 +7,9 @@ const { hasLanCableCarrier } = require('./network');
/**
* OpenVFD 图标:/sys/class/leds/openvfd/led_on|led_off写入图标名
*
* 映射与面板丝印一致play=WiFi 状态,wifi+eth=有线链路
* play → 产品 WiFi 灯(配网逻辑 on/off/blink
* wifi + eth 同亮/同灭 → LAN有线插拔见 hasLanCableCarrier / CLAWD_ETH_IFACE
* 映射(与面板丝印一致:LAN=playWiFi=wifi+eth
* wifi + eth 同亮/同灭 → 产品 WiFi 灯(配网 on/off/blink
* play → LAN有线插拔见 hasLanCableCarrier / CLAWD_ETH_IFACE
* alarm → pwrSETUP=灭 / APPS=亮)
* BT → 无 sysfs仅日志
*
@@ -100,9 +100,8 @@ class WifiLed {
_write(val) {
const on = !!val;
log.debug('led', `[vfd] WiFiplay<= ${on ? 1 : 0}`);
if (on) vfdOn('play');
else vfdOff('play');
log.debug('led', `[vfd] WiFiwifi+eth<= ${on ? 1 : 0}`);
vfdWifiPair(on);
}
}
@@ -260,7 +259,7 @@ class LanLed {
clearInterval(this._timer);
this._timer = null;
}
vfdWifiPair(false);
vfdOff('play');
this._current = null;
}
@@ -268,14 +267,14 @@ class LanLed {
const up = hasLanCableCarrier();
if (up) {
if (this._current !== 'on') {
vfdWifiPair(true);
vfdOn('play');
this._current = 'on';
log.info('led', 'LAN有线 carrier→ 亮');
log.info('led', 'LANplay / 有线 carrier→ 亮');
}
} else if (this._current !== 'off') {
vfdWifiPair(false);
vfdOff('play');
this._current = 'off';
log.info('led', 'LAN有线 carrier→ 灭');
log.info('led', 'LANplay / 有线 carrier→ 灭');
}
}
}

View File

@@ -199,7 +199,7 @@ class ProvisionManager extends EventEmitter {
this.emit('network-ready');
}
// 产品 WiFi 灯OpenVFD playAP 全程强制熄灭,避免与其它逻辑竞态导致误亮
// 产品 WiFi 灯OpenVFD wifi+ethAP 全程强制熄灭,避免与其它逻辑竞态导致误亮
if (this._state === 'ap') {
led.off();
} else if (this._state === 'sta') {