From: penglei <1624952103@qq.com> Date: Thu, 5 Sep 2024 11:07:02 +0000 (+0800) Subject: 优化佩戴检测:小睡模式开启纯佩戴 睡眠模式开启活体佩戴 。 X-Git-Tag: release_V1.2.70_20241020_135402~518^2~18^2~1 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=4192d9df2ce4d7322082f47a7707c6c667681920;p=mirrors%2FFD230.git 优化佩戴检测:小睡模式开启纯佩戴 睡眠模式开启活体佩戴 。 纯佩戴检测Timer修改为5分钟。 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp index 73056b053..5523af3d2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp @@ -36,6 +36,7 @@ #include "AppViewIDs.h" #include "player/include/PlayersView.h" #include "record/include/RecordingPlayerView.h" +#include "ppg_service.h" #ifdef __cplusplus extern "C" @@ -434,6 +435,7 @@ extern "C" uapi_dev_runtime_set_nap_monitoring_status(1); uapi_dev_runtime_set_sleep_monitoring_status(0); OHOS::SleepModel::GetInstance().ReInitData(); // 更新睡眠数据 + set_keep_in_wear_det_mode(1); //开启小睡佩戴监测 SendMsgToUIService(UI_UPDATE_SLEEP_DATA, 0, nullptr, 0); do_cywee_service_check_msg(CYWEE_SERVICE_CMD_NAP_SEDENTARY_MODE, NULL); // 算法底层切换小睡监测模式 } @@ -446,6 +448,7 @@ extern "C" OHOS::clean_sleep_data(); // 清零睡眠文件存储数据 uapi_dev_runtime_set_sleep_monitoring_status(1); uapi_dev_runtime_set_nap_monitoring_status(0); + set_keep_in_wear_det_mode(0); //关闭小睡佩戴监测 do_cywee_service_check_msg(CYWEE_SERVICE_CMD_GET_SLEEP_DATA, NULL); // 强制获取小睡数据,结束小睡 // 睡眠弹窗 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "要睡觉啦!"); diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index 67484b953..79975e118 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -2720,11 +2720,14 @@ static void get_avg_hrs(int32_t hrs) void hx3695_wearstatus_update(void) { - if(wear_status != hrsresult.wearstatus) + if(uapi_dev_runtime_get_sleep_monitoring_status())//处于睡眠监测 上报活体佩戴 { - wear_status = hrsresult.wearstatus; - cywee_data = wear_status; - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_WEAR_STATUS_CHANGE,&cywee_data); + if(wear_status != hrsresult.wearstatus) + { + wear_status = hrsresult.wearstatus; + cywee_data = wear_status; + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_WEAR_STATUS_CHANGE,&cywee_data); + } } } diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/tyhx_hrs_custom.h b/code/sdk/drivers/peripheral/ppg/hx3695/tyhx_hrs_custom.h index bd64ef3ed..35bfef20d 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/tyhx_hrs_custom.h +++ b/code/sdk/drivers/peripheral/ppg/hx3695/tyhx_hrs_custom.h @@ -8,7 +8,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-03-26 20:29:58 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-04-30 09:31:34 + * @LastEditTime: 2024-09-05 19:04:40 * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/hx3695/tyhx_hrs_custom.h * @Description: * @@ -77,7 +77,8 @@ uint32_t tyhx_read_regs( uint8_t reg_addr,uint8_t *readbuf,uint16_t readlen); #define TYHX_TIMER_40MS 40 #define TYHX_TIMER_320MS 320 -#define TYHX_TIMER_5000MS 5000 +#define TYHX_TIMER_5000MS 1000 * 60 * 5 //纯佩戴修改为5分钟 +//#define TYHX_TIMER_5000MS 5000 bool tyhx_timer_start(uint32_t ms); bool tyhx_timer_stop(uint32_t ms);