From: hcj <1224667075@qq.com> Date: Mon, 15 Dec 2025 09:09:28 +0000 (+0800) Subject: 28版本下载兼容修改 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=78537b68f13dd1076f9161aabcfcb09e907874f5;p=mirrors%2FFD230.git 28版本下载兼容修改 --- diff --git a/code/sdk/zhihui/4g/cat1Service/Service/http_file_download_client.c b/code/sdk/zhihui/4g/cat1Service/Service/http_file_download_client.c index 9859f2439..58f6a5820 100644 --- a/code/sdk/zhihui/4g/cat1Service/Service/http_file_download_client.c +++ b/code/sdk/zhihui/4g/cat1Service/Service/http_file_download_client.c @@ -494,7 +494,16 @@ int http_file_download_start(const char *url, const char *file_path, uint32_t ti // 通过UDP发送下载指令到CAT1,附带写延时参数(格式:URL|resume_from_byte|write_delay_ms) char udp_msg[1024] = {0}; - int msg_len = snprintf(udp_msg, sizeof(udp_msg), "%s|%u|%u", url, 0u, write_delay_ms); + int msg_len; + + if(g_py_ver==28) + { + msg_len = snprintf(udp_msg, sizeof(udp_msg), "%s", url); + } + else + { + msg_len = snprintf(udp_msg, sizeof(udp_msg), "%s|%u|%u", url, 0u, write_delay_ms); + } if (msg_len < 0 || msg_len >= (int)sizeof(udp_msg)) { cat1_print_err("HTTP file download: Failed to format UDP message\n"); g_download_state = HTTP_DOWNLOAD_STATE_IDLE; diff --git a/code/sdk/zhihui/utils/custom_spi.c b/code/sdk/zhihui/utils/custom_spi.c index 71265c8f1..1e79664b3 100644 --- a/code/sdk/zhihui/utils/custom_spi.c +++ b/code/sdk/zhihui/utils/custom_spi.c @@ -109,18 +109,18 @@ static void custom_spi_read_v28(void) ret = uapi_spi_slave_read(SPI_BUS_1, &spi_data, 50); - uint32_t expected_packet_size = 4 + SPI_PACKET_DATA_SIZE; // 1020字节 + // uint32_t expected_packet_size = 4 + SPI_PACKET_DATA_SIZE; // 1020字节 - if(ret == 0 && spi_data.rx_bytes == expected_packet_size) + if(ret == 0 && spi_data.rx_bytes == SPI_PACKET_TOTAL_SIZE) { // 解析包头:前4字节为数据长度(小端序) uint32_t data_len = unpack_uint32_le(g_rx_buffer); const uint8_t *data_ptr = g_rx_buffer + 4; // 数据部分从第4字节开始 // 验证数据长度合理性(应该在0到SPI_PACKET_DATA_SIZE之间) - if (data_len > SPI_PACKET_DATA_SIZE) { + if (data_len > SPI_PACKET_DATA_SIZE+4) { printf("SPI packet error (v28): invalid data length %u (max: %u)\n", - data_len, SPI_PACKET_DATA_SIZE); + data_len, SPI_PACKET_DATA_SIZE+4); total_byte_error_cnt++; // 版本28:只触发错误回调,不触发中断 trigger_error_callback(CUSTOM_SPI_ERROR_INVALID_DATA_LEN, @@ -158,7 +158,7 @@ static void custom_spi_read_v28(void) else { printf("SPI read error (v28): ret=0x%x, rx_bytes=%u (expected: %u)\n", - ret, spi_data.rx_bytes, expected_packet_size); + ret, spi_data.rx_bytes, SPI_PACKET_TOTAL_SIZE); total_byte_error_cnt++; // 版本28:只触发错误回调,不触发中断 trigger_error_callback(CUSTOM_SPI_ERROR_READ_FAILED,