feat: USE_FLATNESS_EXIT 宏开关 — 平坦性/简单防抖可切换
- TaskLoop.h 新增 #define USE_FLATNESS_EXIT 1 - #if USE_FLATNESS_EXIT 包裹所有平坦性状态变量和逻辑 - #else 回退到 cnt_release>=3 简单防抖 - 置 0 即可切回传统离开判定
This commit is contained in:
@@ -31,6 +31,12 @@
|
||||
*===========================================================================*/
|
||||
#define ALFA_CAP1 79 // IIR 指数平滑 α = 79/256 ≈ 0.31
|
||||
|
||||
/*===========================================================================
|
||||
* 离开检测模式
|
||||
* 1 = 平坦性三条件判定 (CN200910309382), 0 = 简单 cnt_release 防抖
|
||||
*===========================================================================*/
|
||||
#define USE_FLATNESS_EXIT 1
|
||||
|
||||
/*===========================================================================
|
||||
* 频率测量参数
|
||||
* MEASUREMENT_BASE: 自适应测量窗口目标值 (≈131072)
|
||||
@@ -85,6 +91,7 @@ extern uint8_t g_loop_stable; // 线圈数值已稳定 (0=稳定中,
|
||||
|
||||
/* 离开防抖计数器(连续 CAPVD 恢复到阈值以上才释放) */
|
||||
extern uint8_t loop1_cnt_release; // 离开防抖计数
|
||||
#if USE_FLATNESS_EXIT
|
||||
extern uint8_t g_exit_state; // 离开检测: 0=追踪斜率, 1=等待平坦
|
||||
extern uint16_t g_max_slope; // 第一上升坡面最大 |f'|
|
||||
extern uint16_t g_max_slope_rate; // 第一上升坡面最大 |f''|
|
||||
@@ -94,6 +101,7 @@ extern int32_t g_prev_capvd; // 上一帧 CAPVD (差分用)
|
||||
extern int32_t g_prev_first_deriv; // 上一帧一阶导数
|
||||
extern uint8_t g_slope_flat_cnt; // 斜率趋零连续计数
|
||||
extern uint8_t g_flat_ok_cnt; // 平坦条件满足连续计数
|
||||
#endif
|
||||
|
||||
/*===========================================================================
|
||||
* 全局状态变量 — 计数器
|
||||
|
||||
Reference in New Issue
Block a user