feat(protocol): 更新SPI Link协议至v2版本并优化CAN通信

- 将SPI OTA帧格式升级为SPI Link v2,采用新的帧格式:
  | SOF0 0xA5 | SOF1 0x5A | VER 0x02 | FLAGS | SESSION 4B LE |
  TX_SEQ | ACK_SEQ | CREDIT | TYPE | LEN 2B LE | RSV 2B | PAYLOAD |
  CRC32 4B LE |
- 新增V2_OVERHEAD=20字节开销,APP最大payload为236字节,BOOT为108字节
- 修改帧类型定义:ENTER_BOOT从0xB5合并至0xB0,新增CAN业务类型0xC0~C3
- 更新CAN协议文档,支持SPI Link v2-only模式,调整最大业务payload计算
- 扩展0xC1帧功能,支持双向通信和1Hz主动推送ID快照
- 添加0xC3完整ID快照帧类型,包含seq/rx_count等完整字段
- 更新协议文档中的错误码定义和反馈payload格式

refactor(main): 重构主程序入口并添加CAN反馈任务

- 在main.cpp中添加CAN反馈任务,更新启动流程注释
- 创建createCriticalTask辅助函数,统一关键任务创建逻辑
- 调整SPI初始化顺序,确保CAN反馈任务依赖正确
- 优化错误处理机制,关键任务失败时立即重启
- 将GD32版本探测移至ota_relay任务处理
- 更新版本号至0.3.48,调整编译时间和Git哈希

config: 更新SPI和BLE配置参数

- 添加SPI主机相关配置参数,包括CS GPIO、READY GPIO等引脚定义
- 配置SPI缓冲区大小:APP为256字节,BOOT为128字节
- 更新BLE滑动窗口参数,ACK窗口设为32,数据队列深度为72
- 调整SPI工作队列大小至5120字节,增加任务堆栈监控说明
This commit is contained in:
小龙虾
2026-07-16 23:00:15 +08:00
parent 51c89b3065
commit 5db3f66b8e
57 changed files with 4728 additions and 2098 deletions
+1
View File
@@ -35,6 +35,7 @@ html, body {
font-size: 14px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
overflow-x: hidden;
}
/* subtle noise-grid background */
+756 -130
View File
File diff suppressed because it is too large Load Diff
+79 -13
View File
@@ -183,20 +183,37 @@
.heap-bar-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px;
gap: 6px 10px;
}
.heap-bar-text {
order: 1;
flex: 1 1 auto;
min-width: 0;
font-size: 13px;
font-weight: 600;
white-space: nowrap;
min-width: 165px;
color: var(--text);
}
/* 百分比数值与文案同一行;进度条单独占下一行 */
.heap-bar-pct {
order: 2;
flex: 0 0 auto;
font-size: 12px;
font-weight: 600;
min-width: 42px;
text-align: right;
font-variant-numeric: tabular-nums;
color: var(--text-dim);
}
.heap-bar-track {
flex: 1;
order: 3;
flex: 1 1 100%;
width: 100%;
height: 14px;
background: rgba(255,255,255,0.06);
border-radius: 7px;
@@ -210,22 +227,13 @@
border-radius: 7px;
background: linear-gradient(90deg, var(--accent), #5eead4);
transition: width .4s ease;
}
.heap-bar-fill.warn {
background: linear-gradient(90deg, #f59e0b, #d97706);
}
.heap-bar-fill.danger {
background: linear-gradient(90deg, #ef4444, #dc2626);
}
}
.heap-bar-pct {
font-size: 12px;
font-weight: 600;
min-width: 42px;
text-align: right;
font-variant-numeric: tabular-nums;
color: var(--text-dim);
}
.heap-detail-row {
display: flex;
@@ -253,6 +261,26 @@
display: grid;
gap: 8px;
}
/* 默认露出约 3 条(按占用排序后的最高项),其余纵向滚动 */
.status-task-list.list-scroll-top3 {
--status-task-row-est: 6.75rem; /* 单条卡片近似高度(含 meta) */
max-height: calc(3 * var(--status-task-row-est) + 2 * 8px);
overflow-y: auto;
overflow-x: hidden;
padding-right: 4px;
scrollbar-gutter: stable;
overscroll-behavior: contain;
}
.status-task-list.list-scroll-top3::-webkit-scrollbar {
width: 6px;
}
.status-task-list.list-scroll-top3::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.18);
border-radius: 999px;
}
.status-task-list.list-scroll-top3::-webkit-scrollbar-track {
background: transparent;
}
.status-task {
background: var(--bg-elevated);
border: 1px solid var(--border);
@@ -315,6 +343,42 @@
font-size: 11px;
font-family: var(--font-mono);
}
/* 区块内二级折叠:默认 collapsed 收起,点击标题展开 */
.status-subfold {
margin-top: 14px;
}
.status-subfold-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
cursor: pointer;
user-select: none;
padding: 6px 0;
border-radius: var(--radius-sm);
}
.status-subfold-head:hover {
color: var(--text);
}
.status-subfold-title {
margin: 0 !important;
flex: 1;
}
.status-subfold-head .collapse-arrow {
flex: none;
font-size: 10px;
color: var(--text-dim);
transition: transform .15s ease;
}
.status-subfold.collapsed .collapse-arrow {
transform: rotate(-90deg);
}
.status-subfold.collapsed .status-subfold-body {
display: none;
}
.status-subfold-body {
margin-top: 6px;
}
.status-json {
margin-top: 0;
padding: 12px;
@@ -329,6 +393,8 @@
white-space: pre-wrap;
word-break: break-word;
font-family: var(--font-mono);
resize: vertical; /* 展开后可拖动缩放高度 */
min-height: 80px;
}
.status-empty {
padding: 12px;
+85
View File
@@ -46,6 +46,91 @@
align-items: start;
}
/* === 右侧滑出抽屉:堆与任务栈 ===
* 总宽 = peek 把手 + 面板;默认 translateX(面板宽) 只露把手,hover 整板探出 */
.sys-drawer {
--sys-drawer-panel-w: min(380px, calc(100vw - 48px));
--sys-drawer-peek: 36px;
position: fixed;
top: 72px;
right: 0;
z-index: 80;
width: calc(var(--sys-drawer-panel-w) + var(--sys-drawer-peek));
height: calc(100vh - 88px);
max-height: calc(100vh - 88px);
display: flex;
flex-direction: row;
align-items: stretch;
transform: translateX(var(--sys-drawer-panel-w));
transition: transform .28s cubic-bezier(.22, 1, .36, 1);
filter: drop-shadow(-6px 0 18px rgba(0, 0, 0, .35));
}
.sys-drawer:hover,
.sys-drawer:focus-within {
transform: translateX(0);
}
/* 平时露出的竖条把手 */
.sys-drawer-rail {
flex: 0 0 var(--sys-drawer-peek);
width: var(--sys-drawer-peek);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10px;
padding: 14px 4px;
background: linear-gradient(180deg, #1a2a3a 0%, var(--bg-card) 100%);
border: 1px solid var(--border);
border-right: none;
border-radius: var(--radius) 0 0 var(--radius);
cursor: default;
}
.sys-drawer-rail-ico {
font-size: 16px;
line-height: 1;
}
.sys-drawer-rail-text {
writing-mode: vertical-rl;
text-orientation: mixed;
font-size: 12px;
font-weight: 600;
letter-spacing: .12em;
color: var(--text-dim);
text-transform: none;
}
.sys-drawer:hover .sys-drawer-rail-text,
.sys-drawer:focus-within .sys-drawer-rail-text {
color: var(--accent);
}
.sys-drawer-panel {
flex: 1 1 var(--sys-drawer-panel-w);
width: var(--sys-drawer-panel-w);
min-width: 0;
height: 100%;
margin: 0 !important;
display: flex;
flex-direction: column;
border-radius: 0;
overflow: hidden;
background: var(--bg-card);
border: 1px solid var(--border);
border-left: none;
border-right: none;
}
.sys-drawer-head {
cursor: default;
flex-shrink: 0;
}
.sys-drawer-head .card-head-btn {
margin-left: auto;
}
.sys-drawer-body {
flex: 1;
min-height: 0;
overflow-y: auto;
overscroll-behavior: contain;
}
/* === CARDS === */
.card {
background: var(--bg-card);
+34 -3
View File
@@ -2,6 +2,16 @@
/* === RESPONSIVE === */
@media (max-width: 1100px) {
.main-layout { grid-template-columns: 1fr; }
.sys-drawer {
--sys-drawer-panel-w: min(340px, calc(100vw - 40px));
--sys-drawer-peek: 32px;
top: 64px;
height: calc(100vh - 72px);
max-height: calc(100vh - 72px);
}
.can-monitor-drawer {
--sys-drawer-panel-w: min(400px, calc(100vw - 40px));
}
.badge-grid { grid-template-columns: repeat(2, 1fr); }
.can-toolbar-grid,
.can-toolbar-foot,
@@ -13,6 +23,14 @@
}
@media (max-width: 640px) {
.container { padding: 16px; }
.sys-drawer {
--sys-drawer-panel-w: calc(100vw - 36px);
--sys-drawer-peek: 28px;
top: 56px;
height: calc(100vh - 60px);
max-height: calc(100vh - 60px);
}
.sys-drawer-rail-text { font-size: 11px; }
.header-bar { flex-direction: column; align-items: flex-start; }
.badge-grid, .metric-grid { grid-template-columns: 1fr; }
.status-kv-grid, .status-task-meta { grid-template-columns: 1fr; }
@@ -27,20 +45,33 @@
align-items: flex-start;
}
.can-selection-bar,
.can-selection-actions,
.history-item-top {
.can-selection-actions {
flex-direction: column;
align-items: flex-start;
}
.can-msg-toolbar {
flex-wrap: wrap;
}
.history-item-row {
grid-template-columns: auto 56px minmax(0, 1fr);
grid-template-rows: auto auto;
}
.history-item-hex,
.history-item-foot {
grid-column: 1 / -1;
text-align: left;
}
.can-title {
font-size: 22px;
}
.can-frame-hex {
font-size: 15px;
}
/* 禁止再强制 980px 最小宽,避免报文/信号表横向滑动 */
.message-table,
.signal-table {
min-width: 980px;
min-width: 0;
max-width: 100%;
}
}