feat(display): 未激活+连网时 VFD 显示 PIN 码中间4位
Made-with: Cursor
This commit is contained in:
@@ -242,6 +242,7 @@ class ClawClient {
|
|||||||
|
|
||||||
if (msg.status === 'inactive') {
|
if (msg.status === 'inactive') {
|
||||||
led.status.setSetup(); // 未激活 → SETUP 亮
|
led.status.setSetup(); // 未激活 → SETUP 亮
|
||||||
|
led.display.showPinMiddle4(msg.pin); // 未激活 + 连网 → 显示 PIN 中间4位
|
||||||
const id = String(msg.claw_id).padEnd(6);
|
const id = String(msg.claw_id).padEnd(6);
|
||||||
const pin = String(msg.pin);
|
const pin = String(msg.pin);
|
||||||
log.info('clawd', '');
|
log.info('clawd', '');
|
||||||
@@ -254,6 +255,7 @@ class ClawClient {
|
|||||||
log.info('clawd', '等待激活,心跳正常运行...');
|
log.info('clawd', '等待激活,心跳正常运行...');
|
||||||
} else {
|
} else {
|
||||||
led.status.setApps(); // 已激活 → APPS 亮
|
led.status.setApps(); // 已激活 → APPS 亮
|
||||||
|
led.display.showTime(); // 已激活 → 显示时间
|
||||||
log.info('clawd', `已激活 claw_id = ${msg.claw_id}`);
|
log.info('clawd', `已激活 claw_id = ${msg.claw_id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,14 @@ class Display {
|
|||||||
log.info('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);
|
||||||
|
this._write('#m3 ' + mid4);
|
||||||
|
log.info('display', `显示屏 → PIN 中间4位: ${mid4}`);
|
||||||
|
}
|
||||||
|
|
||||||
_write(val) {
|
_write(val) {
|
||||||
try {
|
try {
|
||||||
// 用 shell 管道写入,与 echo "..." | tee ... 行为完全一致
|
// 用 shell 管道写入,与 echo "..." | tee ... 行为完全一致
|
||||||
|
|||||||
Reference in New Issue
Block a user