修复了配网时进入休眠导致配网时间变成的问题,同时增加配网时间到了之后停止广播

This commit is contained in:
2026-09-10 12:14:29 +08:00
parent 5875d2a339
commit c141c7e0aa
6 changed files with 73 additions and 27 deletions
+19 -6
View File
@@ -2,11 +2,12 @@
* @file usr_le_adv.c
* @brief BLE 广播 / 配对 / OTA 广播切换
* @author cyWu <1917507415@qq.com>
* @date 2026.08.19
* @version V1.1.0
* @date 2026.09.10
* @version V1.2.0
* @history
* - V1.0.0, 2026.08.03, cyWu, 首次发布
* - V1.1.0, 2026.08.19, cyWu, 对齐模组注释与助手;保留 SOC 上电绑广播策略
* - V1.2.0, 2026.09.10, cyWu, 配对窗口超时停止绑定广播
******************************************************************************/
#include "system/includes.h"
@@ -138,16 +139,28 @@ void usr_goto_pair_mode(void)
usr_ble_adv_init();
}
/**
* @brief 停止绑定广播:清配网标志、关掉广播;未完成的连接一并断开
* @note 只关广播,500ms 协议定时器还在,避免把 usr_timer_loop 停掉。
* usr_adv_flag 清 0 后周期刷新不会再 enable,广播不会自己开回来。
* @return 无
*/
void usr_stop_bind_adv(void)
{
printf("usr_stop_bind_adv\n");
ble_multi_trans_disconnect();
usr_var.usr_goto_pair = 0;
usr_var.usr_adv_flag = 0;
ble_trans_module_enable(0);
}
/**
* @brief 断开 BLE 并停止广播(复位/重启前)
*/
void usr_ble_disconnect_and_stop_adv(void)
{
printf("usr_ble_disconnect_and_stop_adv\n");
ble_multi_trans_disconnect();
usr_var.usr_goto_pair = 0;
usr_var.usr_adv_flag = 0;
ble_trans_module_enable(0);
usr_stop_bind_adv();
}
/**
+11 -2
View File
@@ -2,12 +2,13 @@
* @file usr_le_api.h
* @brief usr_le_code 对外应用 API(配网 / 配对 / OTA
* @author cyWu <1917507415@qq.com>
* @date 2026.08.03
* @version V1.0.2
* @date 2026.09.10
* @version V1.0.3
* @history
* - V1.0.0, 2026.08.03, cyWu, 首次发布
* - V1.0.1, 2026.08.19, cyWu, 收敛公开 API,移除 BLE 栈钩子声明
* - V1.0.2, 2026.08.25, cyWu, 改为源码编译,去掉静态库
* - V1.0.3, 2026.09.10, cyWu, 增加配对窗口超时停绑定广播
*
* @note usr_ble_adv_init / usr_le_data_recieve 为 BLE/RCSP 协议栈链接钩子,
* 由 usr_le_code 内部实现并导出符号,不作为应用层公开接口。
@@ -47,6 +48,14 @@ void usr_clear_pair_info(void);
*/
uint8_t usr_get_pair_flag(void);
/**
* @brief 停止绑定广播(配对窗口超时)
* @note 清 usr_goto_pair,关掉广播;若绑定未完成则断开连接。
* 已配网的回连广播不走本接口。
* @return 无
*/
void usr_stop_bind_adv(void);
/**
* @brief 启动应用侧 OTA 流程
* @note 置位 usr_goto_updata,并创建 1s 周期定时器驱动断连与 OTA 广播切换