This commit is contained in:
zhoujie 2026-03-15 10:22:22 +08:00
parent 3bbb500a61
commit d8558bd8d4
3 changed files with 19 additions and 10 deletions

View File

@ -346,12 +346,14 @@ static void parse_and_dispatch_tlv(TcpStreamCtx_t *ctx, const uint8_t *packet,
cfg_updated = 1; cfg_updated = 1;
qdx_port_mutex_unlock(g_TcpLogic.config_mutex); qdx_port_mutex_unlock(g_TcpLogic.config_mutex);
DBG_CFG("<< Config1D: En=%d RunMode=%d TrigType=%d " 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.Enabled,
(int)g_TcpLogic.cached_cfg1d.RunMode, (int)g_TcpLogic.cached_cfg1d.RunMode,
(int)g_TcpLogic.cached_cfg1d.TriggerType, (int)g_TcpLogic.cached_cfg1d.TriggerType,
(int)g_TcpLogic.cached_cfg1d.BufferSize, (int)g_TcpLogic.cached_cfg1d.BufferSize,
(int)g_TcpLogic.cached_cfg1d.TriggerTempLimit, (int)g_TcpLogic.cached_cfg1d.TriggerTempLimit,
(int)g_TcpLogic.cached_cfg1d.LSizeStart,
(int)g_TcpLogic.cached_cfg1d.RSizeStart,
(int)g_TcpLogic.cached_cfg1d.NGioDelay); (int)g_TcpLogic.cached_cfg1d.NGioDelay);
} }
break; break;

View File

@ -97,7 +97,7 @@
#define configTICK_RATE_HZ ( ( TickType_t ) 500 ) #define configTICK_RATE_HZ ( ( TickType_t ) 500 )
#define configMAX_PRIORITIES ( 15 ) #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 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 configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 0 #define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0

View File

@ -43,7 +43,7 @@
/* ============================================================ /* ============================================================
* TX Buffers (double-buffered for zero-copy) * 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_A_Mem[MAX_TCP_PAYLOAD_SIZE];
uint8_t g_TxNetBuffer_B_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. * 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) static uint16_t get_1d_sample(const RawImageBuffer_t *raw)
{ {
uint16_t w = raw->Width; uint16_t w = raw->Width;
uint16_t h = raw->Height; uint16_t h = raw->Height;
uint16_t row = h / 2;
uint16_t *src = raw->pData; uint16_t *src = raw->pData;
uint16_t max_temp = 0; uint16_t max_temp = 0;
for (uint16_t x = 0; x < w; x++) { uint32_t total = (uint32_t)w * h;
uint16_t t = src[row * w + x]; for (uint32_t i = 0; i < total; i++) {
if (t > max_temp) max_temp = t; if (src[i] > max_temp) max_temp = src[i];
} }
return max_temp; return max_temp;
} }
@ -494,10 +493,18 @@ static void send_1d_collection(const Config1D_t *cfg, uint8_t *use_buf_a)
uint16_t end = s1d_count; uint16_t end = s1d_count;
if (cfg->RSizeStart > 0 && cfg->RSizeStart < end) if (cfg->RSizeStart > 0 && cfg->RSizeStart < end)
end -= cfg->RSizeStart; end -= cfg->RSizeStart;
/* Clamp: ensure valid slice even if server sends bad L/R values */
if (start >= end) { if (start >= end) {
DBG_ERR("1D: slice empty start=%d end=%d\r\n", (int)start, (int)end); 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; return;
} }
}
uint16_t n = end - start; uint16_t n = end - start;
TcpTxBuffer_t *tx_buf = (*use_buf_a) ? &g_TxNetBuffer_A : &g_TxNetBuffer_B; TcpTxBuffer_t *tx_buf = (*use_buf_a) ? &g_TxNetBuffer_A : &g_TxNetBuffer_B;