增加断网后重连广播和温湿度广播循环切换

This commit is contained in:
2026-09-03 14:57:03 +08:00
parent 5625362916
commit 9a2fdb1709
5 changed files with 312 additions and 6 deletions
+14
View File
@@ -65,4 +65,18 @@ uint8_t app_th_is_fault(void);
*/
uint8_t app_th_last_sample_ok(void);
/**
* @brief 取走一次「本周期采样成功」事件(供 usr_le_adv 的 500ms 任务上下文)
* @note ⚠ 生产者是 app_th_poll(20ms 硬件定时器中断上下文),那里只置
* volatile pending,不开关广播、不打日志、不写 flash。
* 消费者(usr_ble_adv_updataBLE 线程任务上下文)调本函数取走,
* 内部 local_irq_disable 保护,取到即清。
* 只在真正采样成功(last_ok 那次)时产生,失败/fault 不产生,
* 取到的就是本次新值而不是历史有效值。
* @param t_x10 出参:温度 ×10(可为 NULL)
* @param h 出参:湿度 %(可为 NULL)
* @return 1=取到一次新采样,0=无新采样
*/
uint8_t app_th_take_sample(int16_t *t_x10, uint8_t *h);
#endif /* __APP_TH_H__ */