From 5459bdeff72cc7d41b3eab4ece08f52035bf6c4b Mon Sep 17 00:00:00 2001 From: cbb <2625274797@qq.com> Date: Wed, 16 Sep 2026 20:29:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=E6=96=AD=E7=BA=BF=E6=B8=85=E6=8C=87?= =?UTF-8?q?=E6=A0=87=E5=8A=A0=E5=BC=BA=E2=80=94=E2=80=94DeviceLink=20?= =?UTF-8?q?=E7=A6=BB=E7=BA=BF=E4=B9=9F=E6=B8=85=20+=20=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E7=89=88=E6=9C=AC=E6=88=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 入口/stages/polling 带 ?v=20260916d,避免深层 import 被浏览器缓存成旧版; 外壳快照 ESP32 offline 时同样 clearLiveMetricsOnDisconnect。 --- js/app.js | 16 ++++++++++++++-- pages/index.html | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/js/app.js b/js/app.js index c71b1a6..2dcd694 100644 --- a/js/app.js +++ b/js/app.js @@ -17,7 +17,7 @@ import { import { scheduleStatusPoll, startPolling, pausePollingForUpload, resumePollingAfterUpload, pollStatus, pollLogs, setStatusPollIntervalMs -} from './common/polling.js'; +} from './common/polling.js?v=20260916d'; import { OtaSessionState, otaSessionState, otaSessionTarget, otaFailReason, @@ -32,7 +32,7 @@ import { } from './ota/progress.js'; import { updateStagesFromRelayState, updateSystemStatusUi, clearLiveMetricsOnDisconnect -} from './ota/stages.js'; +} from './ota/stages.js?v=20260916d'; import { startEcatLoadPoller } from './ota/ecat_load.js'; import { deviceLink } from './common/device-link.js'; import { @@ -293,6 +293,18 @@ setupDropZone('uploadZoneGd32', 'gd32'); // 否则 polling.js 的 scheduleStatusPoll 会因 window.OtaSessionState 未定义而抛 TypeError) startPolling(); +/* DeviceLink 快照判 ESP32 离线时也清指标: + * 本页 pollStatus 可能 AbortError 静默返回,或 iframe 里旧模块未清—— + * 外壳 Owner 是更权威的「设备在线」来源,离线布尔一翻就清。 */ +deviceLink.subscribe(function (s) { + try { + if (!s || !s.ts || !s.links || !s.links.esp32) return; + if ((Date.now() - s.ts) >= 5000) return; + if (s.links.esp32.online) return; + clearLiveMetricsOnDisconnect(); + } catch (_) {} +}); + // GD32 CPU 负载率(EtherCAT 通道,独立于 /system/status 轮询;页面上无该指标则自动空转) startEcatLoadPoller(); diff --git a/pages/index.html b/pages/index.html index a841fb5..686ab9e 100644 --- a/pages/index.html +++ b/pages/index.html @@ -569,8 +569,8 @@ 必须持有租约,否则服务端在租约归零宽限期后会把循环又停掉。 与 tabs.html / motor.html 并存时连接数>1,互不影响。 --> - - + +