diff --git a/lib/client.js b/lib/client.js index 93a4346..1fe1e64 100644 --- a/lib/client.js +++ b/lib/client.js @@ -242,7 +242,7 @@ class ClawClient { if (msg.status === 'inactive') { led.status.setSetup(); // 未激活 → SETUP 亮 - led.display.showPinMiddle4(msg.pin); // 未激活 + 连网 → 显示 PIN 中间4位 + led.display.showPin(msg.pin); // 未激活 + 连网 → 显示 4 位 PIN const id = String(msg.claw_id).padEnd(6); const pin = String(msg.pin); log.info('clawd', ''); diff --git a/lib/led.js b/lib/led.js index 9ba89cd..fed9f69 100644 --- a/lib/led.js +++ b/lib/led.js @@ -109,13 +109,12 @@ class Display { log.info('display', '显示屏 → 时间'); } - /** 未激活 + 连网 → 显示 PIN 码中间 4 位(6 位 PIN 取第 2~5 位) */ - showPinMiddle4(pin) { - const s = String(pin || ''); - const mid4 = s.length >= 6 ? s.slice(1, 5) : s.padStart(4, '0').slice(-4); + /** 未激活 + 连网 → 显示 PIN 码(4 位数字) */ + showPin(pin) { + const s = String(pin || '').padStart(4, '0').slice(-4); // #m2 模式支持数字,4字符直接跟在模式号后(无空格) - this._write('#m2' + mid4); - log.info('display', `显示屏 → PIN 中间4位: ${mid4}`); + this._write('#m2' + s); + log.info('display', `显示屏 → PIN: ${s}`); } _write(val) {