feat(esp32): 添加多电机OTA中继功能并优化调试日志系统
- 新增多电机状态、版本和OTA中继监控模块(monitor/motor_state.cpp, monitor/motor_version.cpp, monitor/motor_ota_relay.cpp) - 在CAN反馈任务中添加0xC5/0xC6/0xD2类型消息处理,支持多电机状态推送 - 重构调试日志系统,将一次性JSON分配改为512B栈缓冲流式发送,降低内存峰值 - 调试UART波特率从115200提升至30000 - 修改版本管理方式,从自动生version.h改为手动维护 - 更新VSCode设置以支持ESP-IDF开发环境配置 - 在OTA协调器中添加电机OTA互斥机制,防止并发冲突 - 完善中继状态机异常处理,添加远程取消通知机制
This commit is contained in:
+14
-2
@@ -16,6 +16,18 @@ var autoScroll = true;
|
||||
// 缓存 DOM 引用,避免高频日志下重复 getElementById
|
||||
var scrollEl = document.getElementById('logScroll');
|
||||
var countEl = document.getElementById('logCount');
|
||||
var scrollPending = false;
|
||||
|
||||
/** rAF 批量自动滚动:/logs 一轮可能追加几十行,逐行读 scrollHeight 会每行
|
||||
* 触发一次强制布局;合并到下一帧只滚一次,行为不变。 */
|
||||
function scheduleAutoScroll() {
|
||||
if (!autoScroll || !scrollEl || scrollPending) return;
|
||||
scrollPending = true;
|
||||
requestAnimationFrame(function () {
|
||||
scrollPending = false;
|
||||
if (autoScroll && scrollEl) scrollEl.scrollTop = scrollEl.scrollHeight;
|
||||
});
|
||||
}
|
||||
|
||||
// ==================== 日志系统 (带去重 + 自动滚动) ====================
|
||||
function makeLogHash(level, tag, message) {
|
||||
@@ -65,7 +77,7 @@ export function addLog(level, tag, message) {
|
||||
entry.div = div;
|
||||
if (scrollEl) {
|
||||
scrollEl.appendChild(div);
|
||||
if (autoScroll) scrollEl.scrollTop = scrollEl.scrollHeight;
|
||||
scheduleAutoScroll();
|
||||
}
|
||||
syncCount();
|
||||
}
|
||||
@@ -92,7 +104,7 @@ export function setLogFilter(level, btn) {
|
||||
});
|
||||
scrollEl.innerHTML = '';
|
||||
scrollEl.appendChild(frag);
|
||||
if (autoScroll) scrollEl.scrollTop = scrollEl.scrollHeight;
|
||||
scheduleAutoScroll();
|
||||
}
|
||||
export function toggleAutoScroll() {
|
||||
autoScroll = !autoScroll;
|
||||
|
||||
Reference in New Issue
Block a user