feat(rk3588s): unify display state semantics and bump version to 1.4.5

This commit is contained in:
2026-05-23 18:22:13 +08:00
parent 5347a728da
commit 161e0e654c
6 changed files with 390 additions and 377 deletions

View File

@@ -36,19 +36,19 @@ class StatusLed {
class Display { class Display {
showAP() { showAP() {
if (writeLvglCommand('show_text:AP')) { if (writeLvglCommand('show_ap')) {
log.info('display', '显示屏 → AP'); log.info('display', '显示屏 → AP(闪烁)');
} }
} }
showConn() { showConn() {
if (writeLvglCommand('show_text:Conn')) { if (writeLvglCommand('show_conn')) {
log.info('display', '显示屏 → Conn'); log.info('display', '显示屏 → Conn(闪烁)');
} }
} }
showErr0() { showErr0() {
if (writeLvglCommand('show_text:Err0')) { if (writeLvglCommand('show_err0')) {
log.info('display', '显示屏 → Err0'); log.info('display', '显示屏 → Err0');
} }
} }
@@ -61,8 +61,8 @@ class Display {
showPin(pin) { showPin(pin) {
const s = String(pin || '').padStart(4, '0').slice(-4); const s = String(pin || '').padStart(4, '0').slice(-4);
if (writeLvglCommand(`show_text:${s}`)) { if (writeLvglCommand(`show_pin:${s}`)) {
log.info('display', `显示屏 → PIN: ${s}`); log.info('display', `显示屏 → PIN: ${s}(闪烁)`);
} }
} }
} }

View File

@@ -124,7 +124,6 @@ class ProvisionManager extends EventEmitter {
if (this._state === 'ap') return; if (this._state === 'ap') return;
led.off(); // AP 模式WiFi 未连接WiFi 灯熄灭 led.off(); // AP 模式WiFi 未连接WiFi 灯熄灭
if (!hasInternet()) led.display.showAP(); // 无网时立即显示 AP有线时等 WS 连接后再定
try { try {
// 若上次进程退出前留下 clawd-hotspot必须先释放 wlan0否则会在 AP 模式下扫描,列表可能只剩 2.4G/自身热点。 // 若上次进程退出前留下 clawd-hotspot必须先释放 wlan0否则会在 AP 模式下扫描,列表可能只剩 2.4G/自身热点。
@@ -149,6 +148,7 @@ class ProvisionManager extends EventEmitter {
this._server.startListening(); this._server.startListening();
this._state = 'ap'; this._state = 'ap';
led.display.showAP();
this._apStartedAt = Date.now(); this._apStartedAt = Date.now();
this._lastApSavedWifiRetryAt = 0; this._lastApSavedWifiRetryAt = 0;
log.info('provision', `AP 常驻模式已启动: ${ap.ssid}, 密码 12345678`); log.info('provision', `AP 常驻模式已启动: ${ap.ssid}, 密码 12345678`);

Binary file not shown.

View File

@@ -142,7 +142,6 @@ static void apply_show_text_async(void *arg)
{ {
const char *text = (const char *)arg; const char *text = (const char *)arg;
show_custom_text = true; show_custom_text = true;
custom_text_blink = false;
custom_text_visible = true; custom_text_visible = true;
lv_label_set_text(custom_text_label, text ? text : ""); lv_label_set_text(custom_text_label, text ? text : "");
lv_obj_align(custom_text_label, LV_ALIGN_CENTER, 0, -25); lv_obj_align(custom_text_label, LV_ALIGN_CENTER, 0, -25);
@@ -201,14 +200,28 @@ static void *fifo_thread(void *arg)
line[--len] = '\0'; line[--len] = '\0';
} }
if (strncmp(line, "show_text:", 10) == 0) { if (strcmp(line, "show_ap") == 0) {
lv_async_call(apply_show_ap_async, NULL);
} else if (strcmp(line, "show_conn") == 0) {
strncpy(custom_text_buf, "Conn", sizeof(custom_text_buf) - 1);
custom_text_buf[sizeof(custom_text_buf) - 1] = '\0';
custom_text_blink = true;
lv_async_call(apply_show_text_async, custom_text_buf);
} else if (strcmp(line, "show_err0") == 0) {
strncpy(custom_text_buf, "Err0", sizeof(custom_text_buf) - 1);
custom_text_buf[sizeof(custom_text_buf) - 1] = '\0';
custom_text_blink = false;
lv_async_call(apply_show_text_async, custom_text_buf);
} else if (strncmp(line, "show_pin:", 9) == 0) {
strncpy(custom_text_buf, line + 9, sizeof(custom_text_buf) - 1);
custom_text_buf[sizeof(custom_text_buf) - 1] = '\0';
custom_text_blink = true;
lv_async_call(apply_show_text_async, custom_text_buf);
} else if (strncmp(line, "show_text:", 10) == 0) {
strncpy(custom_text_buf, line + 10, sizeof(custom_text_buf) - 1); strncpy(custom_text_buf, line + 10, sizeof(custom_text_buf) - 1);
custom_text_buf[sizeof(custom_text_buf) - 1] = '\0'; custom_text_buf[sizeof(custom_text_buf) - 1] = '\0';
if (strcmp(custom_text_buf, "AP") == 0) { custom_text_blink = false;
lv_async_call(apply_show_ap_async, NULL);
} else {
lv_async_call(apply_show_text_async, custom_text_buf); lv_async_call(apply_show_text_async, custom_text_buf);
}
} else if (strcmp(line, "show_time") == 0) { } else if (strcmp(line, "show_time") == 0) {
lv_async_call(apply_show_time_async, NULL); lv_async_call(apply_show_time_async, NULL);
} }

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "clawd", "name": "clawd",
"version": "1.4.4", "version": "1.4.5",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "clawd", "name": "clawd",
"version": "1.4.4", "version": "1.4.5",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"ssh2": "^1.17.0", "ssh2": "^1.17.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "clawd", "name": "clawd",
"version": "1.4.4", "version": "1.4.5",
"description": "Claw Box daemon - connects local Linux box to claw.cutos.ai via WebSocket", "description": "Claw Box daemon - connects local Linux box to claw.cutos.ai via WebSocket",
"main": "lib/client.js", "main": "lib/client.js",
"bin": { "bin": {