Files
JBao_Door_Clamp_FW/apps/usr_app/app_boot.h
T
wuchuyuan 026d6d5da7 1、开机按满 5s 绿灯先切配对快闪提示,松手才清绑定并进配网,继续按到 12s 仍可改道 OTA
2、app_led_init 提前到按键判定前,3s 常亮 / 5s 快闪 / 拒绝开机低电闪统一走灯效事件表,去掉开机阶段手搓 GPIO 闪烁
2026-08-27 20:19:57 +08:00

34 lines
1.9 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/******************************************************************************
* @file app_boot.h
* @brief 深睡唤醒 / 上电按键判定:3s 开机,5s 配对,12s OTA,不足 3s 松手再睡;
* 开机前电量低于约 5% 且未充电时拒绝开机
* @author cyWu <1917507415@qq.com>
* @date 2026.08.27
* @version V1.2.0
* @history
* - V1.0.0, 2026.08.25, cyWu, 首次发布,实现深睡唤醒按键判定(3s 开机 / 5s 配对)
* - V1.1.0, 2026.08.26, cyWu, 新增 12s 长按进 OTA;新增开机前低电量
* BOARD_VBAT_SHUTDOWN_MV)拦截,仅闪 5 下红灯
* 提示后继续深睡,不接受非充电状态下的开机
* - V1.2.0, 2026.08.27, cyWu, 按满 5s 绿灯即快闪提示,松手才真正提交配网
*
* @note 必须在 BLE 协议栈起来、1ms 定时器启动之前调用。杰理 jiffies 此时
* 往往 10ms 才跳一次,所以内部一律用 timer_get_ms 直接量时间,
* 不能借用按键库的 1ms 状态机(否则长按时长会被严重低估)。
******************************************************************************/
#ifndef __APP_BOOT_H__
#define __APP_BOOT_H__
/**
* @brief 等待并判定开机按键:不足 3s 松手、或全程未按键,直接原地深睡(不返回);
* 满 3s 视为正常开机(绿灯常亮);按满 5s 绿灯改快闪提示“松手即配网”,
* 真正清绑定 / 开绑定广播仍等松手(内部调用 app_pair_start);持续按满
* 12s 直接开机并进入 OTA(调用 usr_app_ota_init)。若未充电且电量低于
* 约 5%,则闪 5 下红灯后继续深睡,拒绝开机。
* @return 无(深睡分支通过 while(1) 喂狗不返回;其余情况正常返回)
*/
void app_boot_wait_key(void);
#endif /* __APP_BOOT_H__ */