25
This commit is contained in:
parent
ade2008f6c
commit
f8420cd3b5
@ -22,8 +22,8 @@
|
||||
* Allows testing each feature independently.
|
||||
* ============================================================ */
|
||||
#define TEST_ENABLE_HEARTBEAT 1 /* Periodic heartbeat debug print task */
|
||||
#define TEST_ENABLE_TRIGGER 1 /* Internal trigger + burst upload */
|
||||
#define TEST_ENABLE_NG_GPIO 1 /* NG GPIO pulse output on detection */
|
||||
#define TEST_ENABLE_TRIGGER 0 /* Internal trigger + burst upload */
|
||||
#define TEST_ENABLE_NG_GPIO 0 /* NG GPIO pulse output on detection */
|
||||
#define TEST_ENABLE_TEMP_REQ 1 /* On-demand frame upload from server */
|
||||
#define TEST_ENABLE_TCP_SEND 1 /* TCP data channel sending */
|
||||
|
||||
@ -306,24 +306,27 @@ static uint32_t burst_next_time_ms = 0; /* next burst frame time */
|
||||
* Pattern 3: Checkerboard with hot cells — tests ROI search
|
||||
* ============================================================ */
|
||||
#define TEST_FPS_DELAY_MS 100 /* ~10 FPS */
|
||||
#define TEMP_RAW(deg_c) ((uint16_t)((deg_c) * 100)) /* e.g. 35.00°C → 3500 */
|
||||
#define TEMP_RAW(deg_c) ((uint16_t)((deg_c) * 10)) /* e.g. 35.0°C → 350, 0.1°C/LSB */
|
||||
|
||||
static void test_fill_gradient(uint16_t *buf, uint16_t w, uint16_t h)
|
||||
{
|
||||
/* Top-to-bottom gradient: 25°C at top → 45°C at bottom */
|
||||
/* Diagonal gradient: 25°C at top-left → 45°C at bottom-right
|
||||
* Both X and Y contribute so 1D center-row also shows variation */
|
||||
for (uint16_t y = 0; y < h; y++) {
|
||||
uint16_t temp = TEMP_RAW(25.0) + (uint16_t)((uint32_t)y * TEMP_RAW(20.0) / h);
|
||||
for (uint16_t x = 0; x < w; x++)
|
||||
for (uint16_t x = 0; x < w; x++) {
|
||||
uint32_t pos = (uint32_t)y * w + (uint32_t)x * h; /* combined weight */
|
||||
uint16_t temp = TEMP_RAW(25.0) + (uint16_t)(pos * TEMP_RAW(20.0) / ((uint32_t)w * h));
|
||||
buf[y * w + x] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void test_fill_hotspot(uint16_t *buf, uint16_t w, uint16_t h)
|
||||
{
|
||||
/* Background 30°C, center 32x32 block at 90°C */
|
||||
/* Background 30°C with slight X variation, center 32x32 block at 90°C */
|
||||
for (uint16_t y = 0; y < h; y++)
|
||||
for (uint16_t x = 0; x < w; x++)
|
||||
buf[y * w + x] = TEMP_RAW(30.0);
|
||||
buf[y * w + x] = TEMP_RAW(28.0) + (uint16_t)((uint32_t)x * TEMP_RAW(4.0) / w);
|
||||
uint16_t cx = w / 2, cy = h / 2;
|
||||
for (uint16_t y = cy - 16; y < cy + 16; y++)
|
||||
for (uint16_t x = cx - 16; x < cx + 16; x++)
|
||||
@ -343,7 +346,7 @@ static void test_fill_checker(uint16_t *buf, uint16_t w, uint16_t h)
|
||||
for (uint16_t y = 0; y < h; y++)
|
||||
for (uint16_t x = 0; x < w; x++) {
|
||||
uint8_t cell = ((y / 32) + (x / 32)) & 1;
|
||||
buf[y * w + x] = cell ? TEMP_RAW(85.0) : TEMP_RAW(30.0);
|
||||
buf[y * w + x] = cell ? TEMP_RAW(85.0) : TEMP_RAW(28.0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -387,6 +390,8 @@ static void task_test_pattern_entry(void *pvParameters)
|
||||
* the current raw image. Scans the center row and packs
|
||||
* TempPoint1D_t (2B time_offset + 2B temp, little-endian).
|
||||
* ============================================================ */
|
||||
#define TEST_1D_POINTS 30 /* 1D test: sample 30 points from center row */
|
||||
|
||||
static void send_1d_frame_from_raw(const RawImageBuffer_t *raw, TcpTxBuffer_t *tx_buf)
|
||||
{
|
||||
uint16_t w = raw->Width;
|
||||
@ -397,7 +402,8 @@ static void send_1d_frame_from_raw(const RawImageBuffer_t *raw, TcpTxBuffer_t *t
|
||||
tx_buf->ValidPayloadLen = 0;
|
||||
uint8_t *dest = tx_buf->pBuffer + tx_buf->HeadOffset;
|
||||
uint32_t capacity = tx_buf->TotalCapacity - tx_buf->HeadOffset;
|
||||
uint16_t points = w;
|
||||
uint16_t points = TEST_1D_POINTS;
|
||||
if (points > w) points = w;
|
||||
if ((uint32_t)points * 4 > capacity)
|
||||
points = (uint16_t)(capacity / 4);
|
||||
|
||||
@ -405,7 +411,9 @@ static void send_1d_frame_from_raw(const RawImageBuffer_t *raw, TcpTxBuffer_t *t
|
||||
int32_t sum_t = 0;
|
||||
|
||||
for (uint16_t i = 0; i < points; i++) {
|
||||
uint16_t temp = src[row * w + i];
|
||||
/* Evenly sample across the full row width */
|
||||
uint16_t col = (uint16_t)((uint32_t)i * (w - 1) / (points > 1 ? points - 1 : 1));
|
||||
uint16_t temp = src[row * w + col];
|
||||
uint16_t time_offset = (uint16_t)((uint32_t)i * 600 / (points > 1 ? points - 1 : 1));
|
||||
int16_t t = (int16_t)temp;
|
||||
if (t < min_t) min_t = t;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user