移除固定的包间延迟配置 `OTA_PACKET_DELAY_MS`,采用基于SPI Link v2 CREDIT背压的动态节奏控制,在SpiMaster中通过remoteCredit==0时wait/拒发 实现流量控制,提高OTA传输稳定性。 refactor(stack): 统一任务栈大小配置并添加CPU统计功能 - 在app_config.h中集中定义所有任务栈大小常量,基于实测水位优化分配 - 新增monitor/cpu_stats.cpp组件,提供1Hz FreeRTOS CPU占用采样 - 更新main.cpp中的任务创建使用新的栈大小常量 - 调整health_monitor和ota_relay等任务的栈分配 perf(ota): 改进ESP32和GD32 OTA分区预擦策略 - ESP32 OTA从边写边擦改为整分区预擦模式,避免写入时的扇区擦除阻塞 - GD32 OTA在prepare阶段进行整分区预擦,提升后续写入吞吐量 - 优化OTA协调器状态管理,修复FINALIZING状态残留问题 fix(log): 改进UDP日志发送的堆内存管理 - 当堆内存不足时记录UDP发送跳过的告警信息到ring buffer - 降低UDP发送跳过的内存阈值从10KB到6KB - 降低日志排水最小内存阈值从8KB到4KB docs(readme): 更新OTA配置参数文档说明 移除已废弃的OTA_PACKET_DELAY_MS参数,更新包间节奏控制说明为 基于CREDIT背压机制的描述。
34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
/**
|
|
* toast.js - Toast 提示组件
|
|
*
|
|
* showToast 函数,操作 DOM 元素 #toast / #toastIco / #toastMsg。
|
|
* 支持 info / success / warning / error 类型,内置 5s 去重防抖。
|
|
*/
|
|
/** @description 显示 Toast 提示消息,支持 info/success/warning/error 类型。 */
|
|
var _toastHideTimer = null;
|
|
var _toastLastKey = '';
|
|
var _toastLastAt = 0;
|
|
export function showToast(message, type) {
|
|
type = type || 'success';
|
|
// 相同文案 5s 内不重复弹,避免轮询把 ✓ 刷成「疯狂跳」
|
|
var key = type + '|' + message;
|
|
var now = Date.now();
|
|
if (key === _toastLastKey && (now - _toastLastAt) < 5000) {
|
|
return;
|
|
}
|
|
_toastLastKey = key;
|
|
_toastLastAt = now;
|
|
|
|
const toast = document.getElementById('toast');
|
|
const ico = document.getElementById('toastIco');
|
|
const msg = document.getElementById('toastMsg');
|
|
toast.className = 'toast ' + (type === 'success' ? 'ok' : type === 'error' ? 'err' : 'warn') + ' show';
|
|
ico.textContent = type === 'success' ? '\u2713' : type === 'error' ? '\u2715' : '\u26A0';
|
|
msg.textContent = message;
|
|
if (_toastHideTimer) clearTimeout(_toastHideTimer);
|
|
_toastHideTimer = setTimeout(function () {
|
|
toast.classList.remove('show');
|
|
_toastHideTimer = null;
|
|
}, 3000);
|
|
}
|