- 实现BLE OTA数据路径分离:添加ble_ota_data.cpp处理重排序/工作线程/DATA_IN, 和ble_ota_host.cpp处理GATT/GAP/广播/主机功能 - 将滑动ACK窗口从32增大到64,实测Windows WebBT环境下固件传输速度提升约10% (从40KB/s提升到44KB/s),内存消耗约30KB重排序缓冲区 - 优化调试日志级别,将OTA相关信息从INFO调整为DBG以减少日志冗余 refactor(can): 改进CAN反馈监听机制 - 将CAN反馈任务从1Hz主动轮询模式改为被动事件监听模式, 使用SpiMaster::takeEvent()替代主动发送0xC1轮询请求 - 更新相关头文件注释说明架构变更,将"周期性轮询"改为"被动接收推送" - 修改调试日志级别,将暂停/恢复状态日志从INFO调整为DBG
42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
/**
|
|
* ble_ota.js - BLE OTA 控制台入口
|
|
*
|
|
* 薄入口:import 所有 ble/* 模块,组装并导出 window.bleOta API 对象,
|
|
* 调用 init() 完成事件绑定与 UI 初始化。
|
|
*/
|
|
import { UI_BUILD } from './ble/constants.js';
|
|
import {
|
|
state, els, bleLog, refreshTargetUi, setConnectionState,
|
|
resetUiAfterDisconnect
|
|
} from './ble/state.js';
|
|
import { resetBleStages } from './ble/stages.js';
|
|
import { connectBle, disconnectBle } from './ble/gatt.js';
|
|
import { clearSelectedFile, notifyFileChange } from './ble/file.js';
|
|
import { autoFlash } from './ble/transfer.js';
|
|
import { abortTask, bindEvents } from './ble/session.js';
|
|
import { showToast } from './common/toast.js';
|
|
|
|
window.bleOta = {
|
|
init: function() {
|
|
bindEvents();
|
|
refreshTargetUi();
|
|
setConnectionState(false);
|
|
resetBleStages();
|
|
bleLog('SYS', `Web Bluetooth 刷写控制台已就绪 (${UI_BUILD})`);
|
|
},
|
|
disconnect: disconnectBle,
|
|
showToast: showToast,
|
|
notifyFileChange: notifyFileChange,
|
|
clearFile: clearSelectedFile,
|
|
refreshButtons: function() {
|
|
setConnectionState(!!state.server);
|
|
},
|
|
refreshTargetUi: refreshTargetUi,
|
|
// ★ 暴露上传状态查询,供 index.html 的 selectFlashTarget 等外部守卫使用
|
|
isUploading: function() {
|
|
return !!(state.uploading || state.autoFlashing);
|
|
},
|
|
};
|
|
|
|
// 脚本以 type="module" 加载(默认 defer),DOM 元素已就绪,直接初始化
|
|
window.bleOta.init(); |