fix: 修复:改进OTA错误处理和BLE OTA性能

- 重构app.js中的OTA错误处理,以准确报告获取失败而不假设重启,从而实现正确的状态轮询。
- 通过将握手状态封装在SpiLinkState类中来增强SPI主状态管理,提高清晰度并减少直接的状态操作。
 引入otaSendAndPoll方法,以更好地处理SPI通信中的命令发送和响应轮询。
- 调整BLE OTA数据包确认逻辑,防止导致固件录变慢的虚假确认,确保仅在实际取得进展时才发送确认。
- 修改确认超时设置,以更好地适应闪存写入速度,减少不重传。
This commit is contained in:
小龙虾
2026-07-09 02:49:24 +08:00
parent 661ae54424
commit fedb08e215
16 changed files with 432 additions and 1369 deletions
+5 -6
View File
@@ -86,19 +86,18 @@ static void taskLoop(void *)
}
/* 解析本页并累积到工作缓冲,page=0 会自动重置 */
const uint8_t page = ring_payload[1];
if (canFdParseFeedbackPage(ring_payload, ring_len,
&s_work[ch], &s_workIdx[ch]) == 0) {
publish(ch, s_work[ch]);
/* 仅在出现错误时打印告警,正常工作静默 */
if (s_work[ch].stats.error_count != 0U) {
DEBUG_INFO(kTag,
"CH%u seq=%lu mode=%u rx=%lu tx=%lu drop=%lu err=%lu",
DEBUG_WARN(kTag,
"CH%u P%u seq=%lu err=%lu",
static_cast<unsigned>(ch),
static_cast<unsigned>(page),
static_cast<unsigned long>(s_work[ch].stats.snapshot_seq),
static_cast<unsigned>(s_work[ch].stats.mode),
static_cast<unsigned long>(s_work[ch].stats.rx_count),
static_cast<unsigned long>(s_work[ch].stats.tx_count),
static_cast<unsigned long>(s_work[ch].stats.rx_drop_count),
static_cast<unsigned long>(s_work[ch].stats.error_count));
}
}