P0功能已实现,按键、LED、过零检测、配网、OTA都已正常实现

This commit is contained in:
2026-09-04 18:49:07 +08:00
parent 2fb61a6458
commit 0de88083ba
47 changed files with 5184 additions and 26 deletions
+67
View File
@@ -0,0 +1,67 @@
/******************************************************************************
* @file app_function.h
* @brief 功能总装:按键动作 + DP 同步(配对/OTA 只在任务上下文落地)
* @author cyWu <1917507415@qq.com>
* @date 2026.09.04
* @version V1.1.0
******************************************************************************/
#ifndef __APP_FUNCTION_H__
#define __APP_FUNCTION_H__
#include <stdint.h>
/**
* @brief 初始化功能模块状态
* @return 无
*/
void app_function_init(void);
/**
* @brief 同步 DPDP0=继电器实际态、DP20=fault_code),每个 20ms 业务 tick 调用
* @note DP0 上报**实际吸合状态**(过零完成之后),让 APP 看见过零完成
* @return 无
*/
void app_function_poll(void);
/**
* @brief 任务上下文周期处理(usr_timer_loop 500ms
* @note 写 VM / 配对 / OTA 只准在此落地,禁止放进 20ms ISR
* @return 无
*/
void app_function_loop(void);
/**
* @brief 业务层短按回调(key_manager 触发):切换加热请求(开↔关,手动抢权)
* @return 无
*/
void usr_on_key_short(void);
/**
* @brief 业务层"按住满 5s"回调(key_manager 触发,20ms 中断上下文)
* @note 只切提示灯(绿灯快闪),不清绑定
* @return 无
*/
void usr_on_key_pair_hint(void);
/**
* @brief 业务层"按满 5s 后松手"回调(key_manager 触发,20ms 中断上下文)
* @note 只置标志:清绑定要写 VM,由 app_function_loop 在任务上下文执行
* @return 无
*/
void usr_on_key_pair_start(void);
/**
* @brief 业务层"按住满 12s"回调(key_manager 触发,20ms 中断上下文)
* @note 只置标志:usr_app_ota_init 由 app_function_loop 在任务上下文执行
* @return 无
*/
void usr_on_key_ota_start(void);
/**
* @brief 出厂重置(DP23 写 1):清业务 VM 与 RAM,保留 BLE 配对(规格书 14 章)
* @return 无
*/
void app_function_factory_reset(void);
#endif /* __APP_FUNCTION_H__ */