为压力检测器添加超时机制、更新翻译
This commit is contained in:
+12
-3
@@ -9,21 +9,30 @@ public:
|
||||
// 每个100ms tick 调用一次
|
||||
// realtimePressure: 实时压力 (sysPara->status.PRESSURE)
|
||||
// calibratedPressure: 标定压力 (sysPara->para.pressure)
|
||||
// 返回 true 表示压力已持续稳定 3 秒
|
||||
// 返回 true 表示:
|
||||
// 1) 压力已持续稳定 3 秒(±10 范围内),或
|
||||
// 2) 超过 2 分钟仍未稳定,兜底超时结束
|
||||
bool tick(float realtimePressure, float calibratedPressure);
|
||||
|
||||
// 重置监测器状态
|
||||
void reset();
|
||||
|
||||
// 当前压力是否在 ±10% 范围内
|
||||
// 当前压力是否在 ±10 范围内
|
||||
bool isCurrentlyInRange() const;
|
||||
|
||||
// 当前连续稳定的 tick 计数
|
||||
int stableTickCount() const;
|
||||
|
||||
// 是否因超时而触发结束(兜底)
|
||||
bool wasTimeout() const;
|
||||
|
||||
private:
|
||||
int m_stableTickCount;
|
||||
static const int REQUIRED_STABLE_TICKS = 30; // 3秒 / 100ms = 30 ticks
|
||||
int m_totalTickCount;
|
||||
bool m_timeout;
|
||||
|
||||
static const int REQUIRED_STABLE_TICKS = 30; // 3秒 / 100ms = 30 ticks
|
||||
static const int TIMEOUT_TICKS = 1200; // 2分钟 / 100ms = 1200 ticks
|
||||
};
|
||||
|
||||
#endif // PRESSUREMONITOR_H
|
||||
Reference in New Issue
Block a user