feat(V4B): V4.36.20 — 最低工作电感量 COIL_L_MIN_UH=20µH, 低于按线圈断开指示

用户需求: 设定最低电感量工作值(默认 20µH, 43nF 低频档口径, 宏定义);
线圈电感量低于该值 → 黄灯快闪以线圈断开状态指示
- TaskLoop.h: 新增 COIL_L_MIN_UH 20; 频率窗上限 125→171kHz (=L 20.06µH,
  43nF: L=2.533e7/(f²×43)) — 20~38µH 小线圈转为可正常工作(含现场 21/23µH)
- poll_yellow_led 模式1: g_coil_fault==2 归入断开级快闪(!LOOP_OK/reconn_stab 同级)
- 一长一短(模式5)仅保留 coil_fault==1 (L 偏大 f<18kHz)
- coil_monitor 防抖 1s 不变; 继电器/判定逻辑不动(仅指示级)
- test: 171 正常/172(L<20µH) 偏小, L 偏大 17; 全绿
语法0 error, 4测试全绿; spec V2.37 / devlog V2.56
This commit is contained in:
wangfq
2026-09-07 09:08:37 +08:00
parent a3d0b9ff75
commit 16eed844a6
7 changed files with 39 additions and 20 deletions
+8 -7
View File
@@ -14,7 +14,7 @@
#include <stdint.h>
#define COIL_F_OK_MIN_KHZ 18
#define COIL_F_OK_MAX_KHZ 125
#define COIL_F_OK_MAX_KHZ 171
#define COIL_DEF_C_NF 66
static uint8_t g_coil_fault = 0;
@@ -67,9 +67,9 @@ static void test_too_large(void)
static void test_too_small(void)
{
g_coil_fault = 0; g_coil_bad_cnt = 0;
run_ticks(150, 100);
run_ticks(200, 100);
assert(g_coil_fault == 2);
printf("2. L偏小 (f=150kHz, 1s 防抖置位) OK\n");
printf("2. L偏小 (f=200kHz, 1s 防抖置位) OK\n");
}
static void test_recover(void)
@@ -88,9 +88,10 @@ static void test_boundaries(void)
run_ticks(17, 100); assert(g_coil_fault == 1); /* 19 → 偏大 */
run_ticks(62, 100); assert(g_coil_fault == 0); /* 20~125 正常 */
run_ticks(18, 100); assert(g_coil_fault == 0); /* 边界 20 正常 */
run_ticks(125, 100); assert(g_coil_fault == 0); /* 边界 125 正常 */
run_ticks(126, 100); assert(g_coil_fault == 2); /* 126 → 偏小 */
printf("4. 边界 19/20/125/126 OK\n");
run_ticks(125, 100); assert(g_coil_fault == 0); /* 中间 125 正常 (V4.36.20 窗内) */
run_ticks(171, 100); assert(g_coil_fault == 0); /* 边界 171 (=L 20.15µH) 正常 */
run_ticks(172, 100); assert(g_coil_fault == 2); /* 172 → L<20µH 偏小(断开级) */
printf("4. 边界 19/20/171/172 OK\n");
}
static void test_jitter_no_alarm(void)
@@ -111,6 +112,6 @@ int main(void)
test_recover();
test_boundaries();
test_jitter_no_alarm();
printf("\nALL PASS (窗口 18~125kHz, 防抖 1s)\n");
printf("\nALL PASS (窗口 18~171kHz=L 20µH, 防抖 1s)\n");
return 0;
}