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:
@@ -8,6 +8,30 @@ var state = { fbTimer: null, fbInFlight: false };
|
||||
|
||||
var el = {};
|
||||
|
||||
// ── Click-to-Copy (feedback 值单元格) ──────────────────────
|
||||
function copyFbVal(text, target) {
|
||||
if (!text || text === '--') return;
|
||||
function onDone() {
|
||||
target.classList.add('copied');
|
||||
setTimeout(function () { target.classList.remove('copied'); }, 1200);
|
||||
showToast('已复制', 'success');
|
||||
}
|
||||
function fallback() {
|
||||
var ta = document.createElement('textarea');
|
||||
ta.value = text;
|
||||
ta.style.cssText = 'position:fixed;left:-9999px;opacity:0';
|
||||
document.body.appendChild(ta);
|
||||
ta.select();
|
||||
try { document.execCommand('copy'); onDone(); } catch (_) {}
|
||||
document.body.removeChild(ta);
|
||||
}
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard.writeText(text).then(onDone).catch(fallback);
|
||||
} else {
|
||||
fallback();
|
||||
}
|
||||
}
|
||||
|
||||
var ids = [
|
||||
'monIp', 'monTestBtn', 'monConnPill', 'monConnTxt',
|
||||
'monConnIndicator', 'monConnIndicatorTxt', 'monHelper',
|
||||
@@ -293,6 +317,15 @@ export function initCanMonitor() {
|
||||
if (el.btnModeBridge) el.btnModeBridge.addEventListener('click', function () { setCanMode(2); });
|
||||
if (el.idsnapChannel) el.idsnapChannel.addEventListener('change', pollFeedback);
|
||||
|
||||
/* feedback 值 click-to-copy:在 grid 容器上事件代理 */
|
||||
document.querySelectorAll('.feedback-grid').forEach(function (grid) {
|
||||
grid.addEventListener('click', function (e) {
|
||||
var target = e.target.closest('.fb-val');
|
||||
if (!target) return;
|
||||
copyFbVal(target.textContent.trim(), target);
|
||||
});
|
||||
});
|
||||
|
||||
/* 通道卡:默认折叠详情,点标题展开/收起 */
|
||||
document.querySelectorAll('.feedback-channel .feedback-ch-head').forEach(function (head) {
|
||||
var toggle = function (e) {
|
||||
|
||||
Reference in New Issue
Block a user