chore: 解决 stash pop 与 device-link 合并冲突并收回本地 WIP
保留 ConnectionHub(deviceLink 导入/ECAT 自启/pmHold 幂等)与主线 WIP(断线清指标、AUTO_POLL=false、boot_ecat 等)。
This commit is contained in:
@@ -31,7 +31,7 @@ import {
|
||||
markPhaseDone, setProgress, resetProgress, esp32PhaseLabels
|
||||
} from './ota/progress.js';
|
||||
import {
|
||||
updateStagesFromRelayState, updateSystemStatusUi
|
||||
updateStagesFromRelayState, updateSystemStatusUi, clearLiveMetricsOnDisconnect
|
||||
} from './ota/stages.js';
|
||||
import { startEcatLoadPoller } from './ota/ecat_load.js';
|
||||
import { deviceLink } from './common/device-link.js';
|
||||
@@ -45,6 +45,9 @@ import {
|
||||
triggerGd32Relay, markGd32OtaUiComplete, stopRelayProgressWatch,
|
||||
startRelayProgressWatch, emitRelayProgress, ensureRelayProgressComplete
|
||||
} from './ota/upload-gd32.js';
|
||||
import {
|
||||
bootEcatProbe, bootEcatFlash, bootEcatAbort, bootEcatPick, bootEcatReboot, refreshBootEcatUi
|
||||
} from './ota/boot_ecat.js';
|
||||
|
||||
// ==================== 工具函数 ====================
|
||||
function formatPercent(value) {
|
||||
@@ -73,6 +76,9 @@ function updateUploadButtonLabel() {
|
||||
var xhrBusy = !!window.isUploading;
|
||||
if (esp32Btn) esp32Btn.disabled = !window.esp32File || xhrBusy;
|
||||
if (gd32Btn) gd32Btn.disabled = !window.gd32File || xhrBusy;
|
||||
/* EtherCAT 直灌那条通道共用同一块 flash 与同一份已选镜像,可用性在这里一次算完,
|
||||
* 不在 file-handle / progress / console-mode 各抄一遍条件。 */
|
||||
refreshBootEcatUi();
|
||||
}
|
||||
function resetStageFlow() {
|
||||
['s1', 's2', 's3', 's4', 's5', 's6'].forEach(function (id) {
|
||||
@@ -91,6 +97,8 @@ function resetStageFlow() {
|
||||
function applyDisconnectedRuntimeState() {
|
||||
document.getElementById('pillIP').textContent = '--';
|
||||
document.getElementById('pillRSSI').textContent = '--';
|
||||
// 断线约 1s(本轮轮询失败)即清实时指标,防止残留旧温度/电压误导
|
||||
clearLiveMetricsOnDisconnect();
|
||||
// ★ 状态机守卫:会话活跃时不重置进度/阶段,避免覆盖进行中的 OTA 进度
|
||||
if (otaSessionActive()) return;
|
||||
// FAILED 态:保留失败进度显示,只清连接胶囊(让用户看到失败原因)
|
||||
@@ -158,6 +166,7 @@ window.resetProgress = resetProgress;
|
||||
|
||||
window.updateStagesFromRelayState = updateStagesFromRelayState;
|
||||
window.updateSystemStatusUi = updateSystemStatusUi;
|
||||
window.clearLiveMetricsOnDisconnect = clearLiveMetricsOnDisconnect;
|
||||
|
||||
window.handleFileSelect = handleFileSelect;
|
||||
window.pickFileViaFSAPI = pickFileViaFSAPI;
|
||||
@@ -179,6 +188,13 @@ window.startRelayProgressWatch = startRelayProgressWatch;
|
||||
window.emitRelayProgress = emitRelayProgress;
|
||||
window.ensureRelayProgressComplete = ensureRelayProgressComplete;
|
||||
|
||||
window.bootEcatProbe = bootEcatProbe;
|
||||
window.bootEcatFlash = bootEcatFlash;
|
||||
window.bootEcatAbort = bootEcatAbort;
|
||||
window.bootEcatPick = bootEcatPick;
|
||||
window.bootEcatReboot = bootEcatReboot;
|
||||
window.refreshBootEcatUi = refreshBootEcatUi;
|
||||
|
||||
// ==================== 挂载 common/* 函数到 window(供 polling.js 等通过 window.* 调用) ====================
|
||||
window.formatBytes = formatBytes;
|
||||
window.formatTime = formatTime;
|
||||
@@ -231,6 +247,11 @@ document.addEventListener('click', function (ev) {
|
||||
case 'ble-pick-file': var fi = document.getElementById('firmwareFile'); if (fi) fi.click(); break;
|
||||
case 'ble-clear-file': if (window.bleOta) window.bleOta.clearFile(); break;
|
||||
case 'start-upload': startUpload(arg); break;
|
||||
case 'boot-ecat-probe': bootEcatProbe(true); break;
|
||||
case 'boot-ecat-pick': bootEcatPick(); break;
|
||||
case 'boot-ecat-run': bootEcatFlash(); break;
|
||||
case 'boot-ecat-abort': bootEcatAbort(); break;
|
||||
case 'boot-ecat-reboot': bootEcatReboot(); break;
|
||||
case 'restart-esp32': restartEsp32(); break;
|
||||
case 'refresh-system-status': refreshSystemStatusNow(ev); break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user