From d8558bd8d459009e644b157fcd38b224847f1167 Mon Sep 17 00:00:00 2001 From: zhoujie <929834232@qq.com> Date: Sun, 15 Mar 2026 10:22:22 +0800 Subject: [PATCH] 103 --- .../Middle/QDXnetworkStack/qdx_tcp_logic.c | 4 +++- prj/TCPClient/User/FreeRTOSConfig.h | 2 +- prj/TCPClient/User/main.c | 23 ++++++++++++------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/prj/TCPClient/Middle/QDXnetworkStack/qdx_tcp_logic.c b/prj/TCPClient/Middle/QDXnetworkStack/qdx_tcp_logic.c index 9675126..5d4ac2b 100644 --- a/prj/TCPClient/Middle/QDXnetworkStack/qdx_tcp_logic.c +++ b/prj/TCPClient/Middle/QDXnetworkStack/qdx_tcp_logic.c @@ -346,12 +346,14 @@ static void parse_and_dispatch_tlv(TcpStreamCtx_t *ctx, const uint8_t *packet, cfg_updated = 1; qdx_port_mutex_unlock(g_TcpLogic.config_mutex); DBG_CFG("<< Config1D: En=%d RunMode=%d TrigType=%d " - "BufSz=%d TempLim=%d NGio=%d\r\n", + "BufSz=%d TempLim=%d L=%d R=%d NGio=%d\r\n", (int)g_TcpLogic.cached_cfg1d.Enabled, (int)g_TcpLogic.cached_cfg1d.RunMode, (int)g_TcpLogic.cached_cfg1d.TriggerType, (int)g_TcpLogic.cached_cfg1d.BufferSize, (int)g_TcpLogic.cached_cfg1d.TriggerTempLimit, + (int)g_TcpLogic.cached_cfg1d.LSizeStart, + (int)g_TcpLogic.cached_cfg1d.RSizeStart, (int)g_TcpLogic.cached_cfg1d.NGioDelay); } break; diff --git a/prj/TCPClient/User/FreeRTOSConfig.h b/prj/TCPClient/User/FreeRTOSConfig.h index 3c74007..a28b65a 100644 --- a/prj/TCPClient/User/FreeRTOSConfig.h +++ b/prj/TCPClient/User/FreeRTOSConfig.h @@ -97,7 +97,7 @@ #define configTICK_RATE_HZ ( ( TickType_t ) 500 ) #define configMAX_PRIORITIES ( 15 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 ) /* Can be as low as 60 but some of the demo tasks that use this constant require it to be higher. */ -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 12 * 1024 ) ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 16 * 1024 ) ) #define configMAX_TASK_NAME_LEN ( 16 ) #define configUSE_TRACE_FACILITY 0 #define configUSE_16_BIT_TICKS 0 diff --git a/prj/TCPClient/User/main.c b/prj/TCPClient/User/main.c index aff5f5e..31df7e5 100644 --- a/prj/TCPClient/User/main.c +++ b/prj/TCPClient/User/main.c @@ -43,7 +43,7 @@ /* ============================================================ * TX Buffers (double-buffered for zero-copy) * ============================================================ */ -#define MAX_TCP_PAYLOAD_SIZE 10240 +#define MAX_TCP_PAYLOAD_SIZE 9216 uint8_t g_TxNetBuffer_A_Mem[MAX_TCP_PAYLOAD_SIZE]; uint8_t g_TxNetBuffer_B_Mem[MAX_TCP_PAYLOAD_SIZE]; @@ -454,18 +454,17 @@ static void task_test_pattern_entry(void *pvParameters) /* * Extract one representative temperature from a raw frame for 1D. - * Uses max temperature of the center row. + * Returns the global maximum temperature across the entire frame. */ static uint16_t get_1d_sample(const RawImageBuffer_t *raw) { uint16_t w = raw->Width; uint16_t h = raw->Height; - uint16_t row = h / 2; uint16_t *src = raw->pData; uint16_t max_temp = 0; - for (uint16_t x = 0; x < w; x++) { - uint16_t t = src[row * w + x]; - if (t > max_temp) max_temp = t; + uint32_t total = (uint32_t)w * h; + for (uint32_t i = 0; i < total; i++) { + if (src[i] > max_temp) max_temp = src[i]; } return max_temp; } @@ -494,9 +493,17 @@ static void send_1d_collection(const Config1D_t *cfg, uint8_t *use_buf_a) uint16_t end = s1d_count; if (cfg->RSizeStart > 0 && cfg->RSizeStart < end) end -= cfg->RSizeStart; + /* Clamp: ensure valid slice even if server sends bad L/R values */ if (start >= end) { - DBG_ERR("1D: slice empty start=%d end=%d\r\n", (int)start, (int)end); - return; + if (s1d_count > 0) { + DBG_ERR("1D: slice clamp L=%d R=%d cnt=%d\r\n", + (int)cfg->LSizeStart, (int)cfg->RSizeStart, (int)s1d_count); + start = 0; + end = s1d_count; + } else { + DBG_ERR("1D: no data to send\r\n"); + return; + } } uint16_t n = end - start;