fix(OTA): 移除BOM标记并优化OTA处理逻辑

移除了OTA.cpp文件中的BOM标记,删除了调试打印代码,修复了
缓冲区溢出检查逻辑,并简化了结束确认帧的发送方式。

- 移除文件开头的BOM标记
- 删除DEBUG_PRINT相关的调试输出代码
- 修正缓冲区大小检查条件,使用expected_size替代硬编码值
- 将结束确认改为使用结构化ACK消息发送
This commit is contained in:
cbb
2026-06-01 21:27:03 +08:00
parent 4a39028f74
commit c801701783
+3 -8
View File
@@ -1,4 +1,4 @@
#include "OTA.h"
#include "OTA.h"
#include "Can.h"
#include "SpiOta.h"
#include "aes128.h"
@@ -297,10 +297,6 @@ void OTAHandler::process() {
drainFlashBuffer();
if (pending_finish_ack && flash_buf_cnt == 0U) {
pending_finish_ack = false;
#if DEBUG_PRINT
printf("[OTA] flash drain done, send FINISH ACK\r\n");
#endif
send_structured_ack(0xFFFFFFFFU);
}
if (pending_app_jump) {
@@ -625,7 +621,7 @@ void OTAHandler::handleLinkMessage(ota_link_msg_type_t type, u8 *data, u8 len) {
return;
} else {
u32 offset = receive_packet_num * OTA_PACKET_SIZE;
if (offset + OTA_PACKET_SIZE > APP_MAX_SIZE) {
if (offset >= expected_size) {
ota_error = OTA_ERROR_INVALID_SIZE;
ota_state = OTA_STATE_IDLE;
send_error_frame(receive_packet_num, OTA_ERROR_INVALID_SIZE);
@@ -652,8 +648,7 @@ void OTAHandler::handleLinkMessage(ota_link_msg_type_t type, u8 *data, u8 len) {
if (receive_IFEND == 0xFFFFFFFFU) {
ota_state = OTA_STATE_FINISHED;
pending_finish_ack = true;
u8 wait_hint[1] = {0x04};
send_wait_frame(1, wait_hint);
send_structured_ack(0xF0F0F0F0U);
return;
}