fix(led): map LAN to play icon and WiFi status to wifi+eth pair
This commit is contained in:
21
lib/led.js
21
lib/led.js
@@ -7,9 +7,9 @@ const { hasLanCableCarrier } = require('./network');
|
|||||||
/**
|
/**
|
||||||
* OpenVFD 图标:/sys/class/leds/openvfd/led_on|led_off(写入图标名)。
|
* OpenVFD 图标:/sys/class/leds/openvfd/led_on|led_off(写入图标名)。
|
||||||
*
|
*
|
||||||
* 映射(与面板丝印一致:play=WiFi 状态,wifi+eth=有线链路):
|
* 映射(与面板丝印一致:LAN=play,WiFi=wifi+eth):
|
||||||
* play → 产品 WiFi 灯(配网逻辑 on/off/blink)
|
* wifi + eth 同亮/同灭 → 产品 WiFi 灯(配网 on/off/blink)
|
||||||
* wifi + eth 同亮/同灭 → LAN(有线插拔,见 hasLanCableCarrier / CLAWD_ETH_IFACE)
|
* play → LAN(有线插拔,见 hasLanCableCarrier / CLAWD_ETH_IFACE)
|
||||||
* alarm → pwr(SETUP=灭 / APPS=亮)
|
* alarm → pwr(SETUP=灭 / APPS=亮)
|
||||||
* BT → 无 sysfs,仅日志
|
* BT → 无 sysfs,仅日志
|
||||||
*
|
*
|
||||||
@@ -100,9 +100,8 @@ class WifiLed {
|
|||||||
|
|
||||||
_write(val) {
|
_write(val) {
|
||||||
const on = !!val;
|
const on = !!val;
|
||||||
log.debug('led', `[vfd] WiFi(play)<= ${on ? 1 : 0}`);
|
log.debug('led', `[vfd] WiFi(wifi+eth)<= ${on ? 1 : 0}`);
|
||||||
if (on) vfdOn('play');
|
vfdWifiPair(on);
|
||||||
else vfdOff('play');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +259,7 @@ class LanLed {
|
|||||||
clearInterval(this._timer);
|
clearInterval(this._timer);
|
||||||
this._timer = null;
|
this._timer = null;
|
||||||
}
|
}
|
||||||
vfdWifiPair(false);
|
vfdOff('play');
|
||||||
this._current = null;
|
this._current = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,14 +267,14 @@ class LanLed {
|
|||||||
const up = hasLanCableCarrier();
|
const up = hasLanCableCarrier();
|
||||||
if (up) {
|
if (up) {
|
||||||
if (this._current !== 'on') {
|
if (this._current !== 'on') {
|
||||||
vfdWifiPair(true);
|
vfdOn('play');
|
||||||
this._current = 'on';
|
this._current = 'on';
|
||||||
log.info('led', 'LAN(有线 carrier)→ 亮');
|
log.info('led', 'LAN(play / 有线 carrier)→ 亮');
|
||||||
}
|
}
|
||||||
} else if (this._current !== 'off') {
|
} else if (this._current !== 'off') {
|
||||||
vfdWifiPair(false);
|
vfdOff('play');
|
||||||
this._current = 'off';
|
this._current = 'off';
|
||||||
log.info('led', 'LAN(有线 carrier)→ 灭');
|
log.info('led', 'LAN(play / 有线 carrier)→ 灭');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ class ProvisionManager extends EventEmitter {
|
|||||||
this.emit('network-ready');
|
this.emit('network-ready');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 产品 WiFi 灯(OpenVFD play):AP 全程强制熄灭,避免与其它逻辑竞态导致误亮
|
// 产品 WiFi 灯(OpenVFD wifi+eth):AP 全程强制熄灭,避免与其它逻辑竞态导致误亮
|
||||||
if (this._state === 'ap') {
|
if (this._state === 'ap') {
|
||||||
led.off();
|
led.off();
|
||||||
} else if (this._state === 'sta') {
|
} else if (this._state === 'sta') {
|
||||||
|
|||||||
Reference in New Issue
Block a user