Type-C 长供电、上电即工作、无软关机,删除 app_boot/app_power 及 DP0 开关相关逻辑, 去掉空占位 app_fan_run 和无效的 usr_timer_pick_mode/rearm(数码管 4ms 扫描已 priority=1, 系统本来就不会进低功耗)。按键 5s 配对 / 12s OTA 改走 key.c 长按分级,去掉自计时与 1~5s 死区。 新增 app_defer,NVM/配对/OTA 只在 ISR 置位、在 500ms 任务上下文落地,避免再在 usr_timer 里写 flash。 规格书与注释同步精简。
50 lines
1.6 KiB
C
50 lines
1.6 KiB
C
/******************************************************************************
|
||
* @file app_cond.h
|
||
* @brief CBR3 条件引擎(P2):7 组 7 字节条件,比较成立满时长触发模式
|
||
* @author cyWu <1917507415@qq.com>
|
||
* @date 2026.08.29
|
||
* @version V1.0.0,首次发布(P0 仅接口与 stub)
|
||
*
|
||
* @note P2 实现(BOARD_COND_ENABLE=1)。字节布局见规格书 10.2:
|
||
* Byte0=使能 Byte1-2=温度阈值(int16 大端 ×10) Byte3=湿度阈值
|
||
* Byte4=持续分钟(0=立即) Byte5=动作模式 Byte6=Bit7-5 温度比较 /
|
||
* Bit4-2 湿度比较 / Bit1-0 保留。比较编码:1=< 2=<= 3-== 4->= 5->
|
||
* 0/6/7=无条件;两侧都无条件=无效组;两侧有效=AND。
|
||
* ⚠ app_cond_run 由 usr_timer_loop(500ms,任务上下文)调用,
|
||
* 与仲裁器/定时引擎同侧;不放在 20ms usr_timer_tick(中断上下文)。
|
||
******************************************************************************/
|
||
|
||
#ifndef __APP_COND_H__
|
||
#define __APP_COND_H__
|
||
|
||
#include <stdint.h>
|
||
|
||
/**
|
||
* @brief 初始化条件引擎
|
||
* @return 无
|
||
*/
|
||
void app_cond_init(void);
|
||
|
||
/**
|
||
* @brief 推进条件引擎,每个业务 tick 调用一次
|
||
* @param dt 距上次调用的毫秒数
|
||
* @return 无
|
||
*/
|
||
void app_cond_run(uint16_t dt);
|
||
|
||
/**
|
||
* @brief APP 写 DP5 条件总开关
|
||
* @param en 0=关,1=开
|
||
* @return 无
|
||
*/
|
||
void app_cond_set_en(uint8_t en);
|
||
|
||
/**
|
||
* @brief APP 写 DP6~12 条件配置(7 字节)
|
||
* @param idx 1~7
|
||
* @return 无
|
||
*/
|
||
void app_cond_set_config(uint8_t idx);
|
||
|
||
#endif /* __APP_COND_H__ */
|