feat(can): 优化CAN反馈任务错误日志记录机制
- 添加s_lastLoggedError数组跟踪各通道最后记录的错误计数 - 实现错误计数变化时才触发告警,避免重复打印 - 扩展错误日志信息,包含TEC、REC和总线状态详细信息 - 修复P0/P1页面携带相同统计数据时的重复打印问题 perf(ota): 移除冗余的OTA协调器状态检查方法 - 删除isGd32BusyState、isEsp32BusyState等未使用的状态判断方法 - 移除esp32FinalizeErrCategory错误分类函数 - 清理相关的头文件声明,减少代码冗余 refactor(relay): 移除未使用的中继状态获取方法 - 删除getRelaySeq、getRelayTotalPackets状态查询接口 - 移除getGd32Version版本获取方法 - 清理StateLockGuard中的isLocked方法
This commit is contained in:
+1
-25
@@ -833,31 +833,7 @@
|
||||
}
|
||||
|
||||
|
||||
// ===== 重启设备 + 自动重连 =====
|
||||
async function restartEsp32() {
|
||||
if (!state.ctrlChar || !state.device) return;
|
||||
if (!confirm('确定要重启 ESP32 吗?\n\n重启后页面会自动重连。')) return;
|
||||
if (state.expectedReboot) return;
|
||||
state.expectedReboot = true;
|
||||
state.reconnectAttempts = 0;
|
||||
if (typeof connectionMode !== 'undefined' && connectionMode === 'ble') {
|
||||
if (els.connState) els.connState.textContent = '重启中';
|
||||
if (els.connState && els.connState.parentElement) els.connState.parentElement.className = 'pill processing';
|
||||
}
|
||||
setConnectionState(!!state.server);
|
||||
bleLog('SYS', '=== 触发 ESP32 重启 (0xFA) ===');
|
||||
showToast('ESP32 重启中...', 'success');
|
||||
try {
|
||||
await state.ctrlChar.writeValue(new Uint8Array([0xFA]));
|
||||
bleLog('SYS', '0xFA 已发,等待设备端推送 FINISH_REBOOT_NOW 后断开');
|
||||
} catch (e) {
|
||||
bleLog('SYS', '0xFA 发送失败: ' + e.message, 'E');
|
||||
showToast('0xFA 发送失败', 'error');
|
||||
state.expectedReboot = false;
|
||||
setConnectionState(!!state.server);
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 自动重连 =====
|
||||
async function tryReconnect() {
|
||||
if (!state.device || !state.expectedReboot) {
|
||||
state.reconnecting = false;
|
||||
|
||||
Reference in New Issue
Block a user