This commit is contained in:
zhoujie 2026-03-15 09:43:48 +08:00
parent ccac60a1e9
commit 524a274275
4 changed files with 33 additions and 33 deletions

View File

@ -233,7 +233,7 @@ void TcpLogic_InjectTestConfig(const ConfigCommon_t *common, const Config2D_t *c
Config2D_t test_cfg2d; Config2D_t test_cfg2d;
memset(&test_cfg2d, 0, sizeof(test_cfg2d)); memset(&test_cfg2d, 0, sizeof(test_cfg2d));
test_cfg2d.Enabled = 1; test_cfg2d.Enabled = 1;
test_cfg2d.TriggerMode = 1; // 内部触发 test_cfg2d.TriggerMode = 0; // 内部触发 (0=内部, 1=外部)
test_cfg2d.TargetWidth = 64; test_cfg2d.TargetWidth = 64;
test_cfg2d.TargetHeight = 64; test_cfg2d.TargetHeight = 64;
test_cfg2d.TriggerTemperatureThreshold = 800; // 80.0°C test_cfg2d.TriggerTemperatureThreshold = 800; // 80.0°C

View File

@ -182,15 +182,15 @@ task_business_entry (优先级 5, 2ms 轮询)
┌────────────┼────────────┐ ┌────────────┼────────────┐
│ TriggerMode=0 │ TriggerMode=1 │ TriggerMode=0 │ TriggerMode=1
│ (外部触发) │ (内部触发) │ (内部触发) │ (外部触发)
▼ ▼ ▼ ▼
PA0/EXTI0 上升沿 Preprocess_CheckInternalTrigger2D() Preprocess_CheckInternalTrigger2D() PA15/EXTI15 上升沿
│ (TriggerRoi 区域 Max/Avg > Threshold) │ (TriggerRoi 区域 Max/Avg > Threshold)
┌──────────────┐ │ │ ┌──────────────┐
│ DEBOUNCE │ │ │ DEBOUNCE
│ DebounceMs │ │ │ DebounceMs
└──────┬───────┘ │ │ └──────┬───────┘
│ │ │ │
└─────────┬───────────────┘ └─────────┬───────────────┘
@ -215,7 +215,7 @@ task_business_entry (优先级 5, 2ms 轮询)
| 字段 | 类型 | 2D 触发中的作用 | | 字段 | 类型 | 2D 触发中的作用 |
|------|------|----------------| |------|------|----------------|
| `Enabled` | u8 | 1=启用 2D 管线 | | `Enabled` | u8 | 1=启用 2D 管线 |
| `TriggerMode` | u8 | 0=外部(GPIO), 1=内部(温度) | | `TriggerMode` | u8 | 0=内部(温度), 1=外部(GPIO) |
| `TriggerDebounceIntervalMs` | u16 | 外部触发消抖等待 (ms) | | `TriggerDebounceIntervalMs` | u16 | 外部触发消抖等待 (ms) |
| `TriggerDelayMs` | u16 | 触发确认后延迟采集 (ms) | | `TriggerDelayMs` | u16 | 触发确认后延迟采集 (ms) |
| `TriggerBurstCount` | u8 | 连拍帧数 | | `TriggerBurstCount` | u8 | 连拍帧数 |
@ -249,16 +249,16 @@ handle_2d_trigger() → start_2d_burst()
└──────┬──────┘ └──────┬──────┘
┌────────────┼────────────┐ ┌────────────┼────────────┐
│ TriggerType=0 │ TriggerType=1 │ TriggerType=1 │ TriggerType=2
│ (外部触发) │ (内部触发) │ (内部触发) │ (外部触发)
▼ ▼ ▼ ▼
PA0/EXTI0 上升沿 前置环形缓冲(3样本) 前置环形缓冲(3样本) PA15/EXTI15 上升沿
连续3个 ≥ TriggerTempLimit 连续3个 ≥ TriggerTempLimit
▼ │ │ ▼
┌───────────────┐ ┌───────────────┐
│ S1D_DEBOUNCE │ │ │ S1D_DEBOUNCE
│ HighTimerLimit │ │ │ HighTimerLimit
└──────┬────────┘ └──────┬────────┘
│ │ │ │
└─────────┬───────────────┘ └─────────┬───────────────┘
@ -300,8 +300,8 @@ handle_2d_trigger() → start_2d_burst()
| 字段 | 类型 | 1D 采集中的作用 | | 字段 | 类型 | 1D 采集中的作用 |
|------|------|----------------| |------|------|----------------|
| `Enabled` | u8 | 1=启用 1D 管线 | | `Enabled` | u8 | 1=启用 1D 管线 |
| `RunMode` | u8 | 0=STOP, 1=RUN | | `RunMode` | u8 | 0=STOP, 1=RUN, 2=NOP, 3=DEBUG |
| `TriggerType` | u8 | 0=外部(GPIO), 1=内部(温度) | | `TriggerType` | u8 | 1=内部(温度), 2=外部(GPIO) |
| `BufferSize` | u16 | 单次采集最大样本数(停止条件) | | `BufferSize` | u16 | 单次采集最大样本数(停止条件) |
| `TriggerTempLimit` | i16 | 触发/采集温度阈值 (0.1°C/LSB) | | `TriggerTempLimit` | i16 | 触发/采集温度阈值 (0.1°C/LSB) |
| `HighTimerLimit` | u16 | 外部触发消抖时间 (ms) | | `HighTimerLimit` | u16 | 外部触发消抖时间 (ms) |
@ -361,7 +361,7 @@ TEMP_REQ 是服务器主动请求的按需截图通道,与自主触发管线
``` ```
Config2D: Config2D:
Enabled = 1 # 自动启用 2D 管线 Enabled = 1 # 自动启用 2D 管线
TriggerMode = 1 # 内部触发(温度检测) TriggerMode = 0 # 内部触发(温度检测)
TargetWidth = 64 # 预处理输出 64×64 TargetWidth = 64 # 预处理输出 64×64
TargetHeight = 64 TargetHeight = 64
TriggerRoiX/Y = 0, 0 # 全幅扫描 TriggerRoiX/Y = 0, 0 # 全幅扫描
@ -530,7 +530,7 @@ task_business_entry (优先级 5)
| Height | 6 | u16 LE | 设备分辨率高度(仅标记) | | Height | 6 | u16 LE | 设备分辨率高度(仅标记) |
| **TargetWidth** | **23** | **u16 LE** | **预处理输出宽度** | | **TargetWidth** | **23** | **u16 LE** | **预处理输出宽度** |
| **TargetHeight** | **25** | **u16 LE** | **预处理输出高度** | | **TargetHeight** | **25** | **u16 LE** | **预处理输出高度** |
| TriggerMode | 21 | u8 | 0=外部, 1=内部 | | TriggerMode | 21 | u8 | 0=内部, 1=外部 |
| TriggerCondition | 37 | u8 | 0=平均, 1=最大 | | TriggerCondition | 37 | u8 | 0=平均, 1=最大 |
| TriggerTemperatureThreshold | 28 | i16 LE | 触发阈值 (0.1°C/LSB) | | TriggerTemperatureThreshold | 28 | i16 LE | 触发阈值 (0.1°C/LSB) |
| TriggerBurstCount | 30 | u8 | 连拍帧数 | | TriggerBurstCount | 30 | u8 | 连拍帧数 |

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 ) ( 16 * 1024 ) ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 12 * 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

@ -699,8 +699,8 @@ static void handle_2d_trigger(const RawImageBuffer_t *raw, const Config2D_t *t2,
} }
/* Phase 4: check for new trigger */ /* Phase 4: check for new trigger */
if (t2->TriggerMode == 0) { if (t2->TriggerMode == 1) {
/* --- External trigger --- */ /* --- External trigger (TriggerMode=1) --- */
if (g_ext_trigger_flag) { if (g_ext_trigger_flag) {
g_ext_trigger_flag = 0; g_ext_trigger_flag = 0;
DBG_TRIG("2D ext trigger\r\n"); DBG_TRIG("2D ext trigger\r\n");
@ -715,7 +715,7 @@ static void handle_2d_trigger(const RawImageBuffer_t *raw, const Config2D_t *t2,
} }
} }
} else { } else {
/* --- Internal trigger: temperature threshold in TriggerRoi --- */ /* --- Internal trigger (TriggerMode=0): temperature threshold in TriggerRoi --- */
if (Preprocess_CheckInternalTrigger2D(raw) == 1) { if (Preprocess_CheckInternalTrigger2D(raw) == 1) {
DBG_TRIG("2D internal trigger\r\n"); DBG_TRIG("2D internal trigger\r\n");
if (t2->TriggerDelayMs > 0) { if (t2->TriggerDelayMs > 0) {
@ -747,8 +747,8 @@ static void handle_1d_trigger(const RawImageBuffer_t *raw, const Config1D_t *t1,
switch (s1d_state) { switch (s1d_state) {
case S1D_IDLE: case S1D_IDLE:
if (t1->TriggerType == 0) { if (t1->TriggerType == 2) {
/* --- External trigger --- */ /* --- External trigger (TriggerType=2) --- */
if (g_ext_trigger_flag) { if (g_ext_trigger_flag) {
g_ext_trigger_flag = 0; g_ext_trigger_flag = 0;
s1d_debounce_until = sys_tick_ms + t1->HighTimerLimit; s1d_debounce_until = sys_tick_ms + t1->HighTimerLimit;
@ -756,8 +756,8 @@ static void handle_1d_trigger(const RawImageBuffer_t *raw, const Config1D_t *t1,
DBG_TRIG("1D: ext trigger -> debounce %d ms\r\n", DBG_TRIG("1D: ext trigger -> debounce %d ms\r\n",
(int)t1->HighTimerLimit); (int)t1->HighTimerLimit);
} }
} else { } else if (t1->TriggerType == 1) {
/* --- Internal trigger: scan with pre-ring buffer --- */ /* --- Internal trigger (TriggerType=1): scan with pre-ring buffer --- */
s1d_pre_ring[s1d_pre_idx] = sample; s1d_pre_ring[s1d_pre_idx] = sample;
s1d_pre_idx = (s1d_pre_idx + 1) % 3; s1d_pre_idx = (s1d_pre_idx + 1) % 3;
if (s1d_pre_count < 3) s1d_pre_count++; if (s1d_pre_count < 3) s1d_pre_count++;
@ -996,8 +996,8 @@ int main(void)
{ {
Config2D_t test_cfg2d; Config2D_t test_cfg2d;
memset(&test_cfg2d, 0, sizeof(test_cfg2d)); memset(&test_cfg2d, 0, sizeof(test_cfg2d));
test_cfg2d.Enabled = 1; test_cfg2d.Enabled = 0;
test_cfg2d.TriggerMode = 1; /* Internal trigger */ test_cfg2d.TriggerMode = 0; /* Internal trigger (0=内部, 1=外部) */
test_cfg2d.TargetWidth = 64; test_cfg2d.TargetWidth = 64;
test_cfg2d.TargetHeight = 64; test_cfg2d.TargetHeight = 64;
test_cfg2d.TriggerRoiX = 0; test_cfg2d.TriggerRoiX = 0;