1、喷淋器 P1/P2功能实现
2、红灯按连接态慢闪
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
/******************************************************************************
|
||||
* @file app_function.c
|
||||
* @brief 功能总装:喷淋键启停、任务上下文落地配对/OTA(P0 版)
|
||||
* @brief 功能总装:喷淋键启停、出厂重置、任务上下文落地配对/OTA
|
||||
* @author cyWu <1917507415@qq.com>
|
||||
* @date 2026.09.09
|
||||
* @version V1.0.0
|
||||
* @version V1.1.0
|
||||
* @history
|
||||
* - V1.1.0, 2026.09.09, cyWu, P1 加 VM 落盘收口(app_nvm_flush)
|
||||
* - V1.0.0, 2026.09.09, cyWu, P0 首次发布(无 VM/联动/计划;P1+ 再扩展)
|
||||
*
|
||||
* @note ⚠ 硬约束:写 flash(清绑定)、BLE 广播切换(配对/OTA)禁止在
|
||||
@@ -18,6 +19,11 @@
|
||||
#include "app_defer.h"
|
||||
#include "app_led.h"
|
||||
#include "app_spray.h"
|
||||
#include "app_nvm.h"
|
||||
#include "app_arbiter.h"
|
||||
#include "app_runrec.h"
|
||||
#include "app_linkage.h"
|
||||
#include "app_timer_task.h"
|
||||
#include "app_main.h"
|
||||
#include "usr_le_api.h"
|
||||
#include "jb_product.h"
|
||||
@@ -42,6 +48,8 @@ void app_function_init(void)
|
||||
*/
|
||||
void app_function_loop(void)
|
||||
{
|
||||
app_nvm_flush(); /* VM 防抖到点的落盘(任务上下文) */
|
||||
|
||||
if (app_defer_take(APP_DEFER_OTA)) {
|
||||
app_defer_cancel(APP_DEFER_PAIR);
|
||||
usr_app_ota_init();
|
||||
@@ -55,6 +63,23 @@ void app_function_loop(void)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DP24 出厂重置(规格书第 15 章):清业务 VM + RAM 复位
|
||||
* @note 保留 BLE 配对、不断开、不软复位。泵停走请求(下一 tick 生效);
|
||||
* userInit 把 gDevData 全量回默认(DP7=10/3/3、计划全 0、plan_en=0)。
|
||||
* @return 无
|
||||
*/
|
||||
void app_function_factory_reset(void)
|
||||
{
|
||||
app_spray_req_stop(); /* 泵停,DP1=0(不自动喷) */
|
||||
app_nvm_reset(); /* 清 4 个业务 item(保留配对三元组) */
|
||||
userInit(); /* gDevData 全量回默认 */
|
||||
app_runrec_reset(); /* 31 天记录清零 */
|
||||
app_linkage_init(); /* 作废标志/湿度有效位清掉 */
|
||||
app_timer_init(); /* 计划队列清掉 */
|
||||
log_info("factory reset done, business vm cleared\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 同步 DP1 = 喷淋作业态(整轮含间隔等待为 1)
|
||||
* @return 无
|
||||
@@ -75,11 +100,12 @@ void usr_on_key_short(void)
|
||||
if (app_led_is_ota()) {
|
||||
return; /* OTA 进行中忽略(规格书 5.3) */
|
||||
}
|
||||
app_arbiter_manual_intervene(); /* 开/停都是手动抢权,作废联动 */
|
||||
if (app_spray_is_running()) {
|
||||
app_spray_stop();
|
||||
app_spray_req_stop();
|
||||
log_info("spray key short -> stop\n");
|
||||
} else {
|
||||
app_spray_start();
|
||||
app_spray_req_start();
|
||||
log_info("spray key short -> start\n");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user