From 7cf4f9c79af38021cfba4e0d2031a2b1c64abfe6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BD=AD=E7=A3=8A?= <1624952103@qq.com> Date: Wed, 14 Aug 2024 03:45:17 +0000 Subject: [PATCH] Merge #698 into sdk602patch0626 from refs/changes/698/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 优化睡眠模式佩戴检测. * refs/changes/698/head: (2 commits squashed) - 优化睡眠模式佩戴检测. 默认开启睡眠.时间段为20:00~9:00. - 默认关闭睡眠提醒开关 Signed-off-by: aliyun6865282430 <1624952103@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/698 --- .../peripheral/config/include/ConfigModel.h | 6 +++--- .../sdk/drivers/peripheral/ppg/hx3695/hx3695.c | 18 ++++++++++++------ .../sdk/drivers/peripheral/ppg/hx3695/hx3695.h | 2 +- .../drivers/peripheral/ppg/hx3695/hx3695_hal.c | 3 ++- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/code/sdk/drivers/peripheral/config/include/ConfigModel.h b/code/sdk/drivers/peripheral/config/include/ConfigModel.h index 58df2418f..d0a4280e9 100644 --- a/code/sdk/drivers/peripheral/config/include/ConfigModel.h +++ b/code/sdk/drivers/peripheral/config/include/ConfigModel.h @@ -356,9 +356,9 @@ namespace OHOS {ConfigDataType::DATATYPE_INT, "drinkstart", "0" }, // CONFIGMODEL_ITEM_DRINK_START,//提醒开始时间 int类型 前16位小时,后16位分钟 {ConfigDataType::DATATYPE_INT, "drinkend", "0" }, // CONFIGMODEL_ITEM_DRINK_END,//提醒结束时间 int类型 前16位小时,后16位分钟 {ConfigDataType::DATATYPE_INT, "drinkfreq", "0" }, // CONFIGMODEL_ITEM_DRINK_FREQ,//提醒频率 - {ConfigDataType::DATATYPE_INT, "sleep", "0" }, // CONFIGMODEL_ITEM_SLEEP, //开关 - {ConfigDataType::DATATYPE_INT, "sleep_bedtime", "0" }, //CONFIGMODEL_ITEM_SLEEP_BEDTIME,//就寝时间 - {ConfigDataType::DATATYPE_INT, "sleep_getup", "0" }, // CONFIGMODEL_ITEM_SLEEP_GET_UP,//起床时间 + {ConfigDataType::DATATYPE_INT, "sleep", "1" }, // CONFIGMODEL_ITEM_SLEEP, //开关 + {ConfigDataType::DATATYPE_INT, "sleep_bedtime", "1310720" }, //CONFIGMODEL_ITEM_SLEEP_BEDTIME,就寝时间 1310720 : 20 << 16 ,前16位为小时,后16位为分钟 + {ConfigDataType::DATATYPE_INT, "sleep_getup", "589824" }, // CONFIGMODEL_ITEM_SLEEP_GET_UP,起床时间,589824 : 9 << 16 ,前16位为小时,后16位为分钟 {ConfigDataType::DATATYPE_INT, "sleep_remide", "0" }, // CONFIGMODEL_ITEM_SLEEP_REMIND,//提前20分钟提醒开关 {ConfigDataType::DATATYPE_BOOL, "sleep_mode", "false" }, //CONFIGMODEL_ITEM_SLEEP_MODE, //sleep mode {ConfigDataType::DATATYPE_INT, "sedentary_switch", "0" }, // CONFIGMODEL_ITEM_SEDENTARY_SWITCH,//久坐提醒开关 diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index 52e7e85cd..641c7416c 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -2727,6 +2727,16 @@ static void get_avg_hrs(int32_t hrs) } +void hx3695_wearstatus_update(void) +{ + if(wear_mode_status != hrsresult.wearstatus) + { + wear_mode_status = hrsresult.wearstatus; + cywee_data = wear_mode_status; + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_WEAR_STATUS_CHANGE,&cywee_data); + } +} + #ifdef HRS_ALG_LIB /*TYHX 心率模式下 读取PPG, 默认320ms*/ hrs_sensor_data_t hrs_s_dat; @@ -2881,14 +2891,10 @@ void hx3695_hrs_ppg_Int_handle(void) } hx3695_msg_callback_t func = hx3695_get_send_msg_callback_func(); if(func != NULL) - func(HX3695_MSG_TYPE_WEARSTAT_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); - - if(wear_mode_status != hrsresult.wearstatus) { - wear_mode_status = hrsresult.wearstatus; - cywee_data = wear_mode_status; - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_WEAR_STATUS_CHANGE,&cywee_data); + func(HX3695_MSG_TYPE_WEARSTAT_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); } + //PRINT("hx3695 data_cnt: %d, hr_living: %d, hr_living_qu: %d, hr_living_std: %d, hr_result:%d \r\n", //alg_results.data_cnt, hrsresult.hr_living, hrsresult.hr_living_qu, hrsresult.hr_living_std, hrsresult.lastesthrs); diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h index 8fcc766ea..d16717132 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h @@ -297,7 +297,7 @@ void agc_timeout_handler(void * p_context); void heart_rate_meas_timeout_handler(void * p_context); void wear_mode_timeout_handler(void * p_context); void Efuse_Mode_Check(void); - +void hx3695_wearstatus_update(void); #include "hx3695_hal.h" #endif diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c index d3b3b95d6..ff1594600 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-03-13 15:08:38 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-06-17 17:43:19 + * @LastEditTime: 2024-08-14 09:48:59 * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c * @Description: * @@ -76,6 +76,7 @@ void ppg_send_cmd_to_driver(char* mode, uint8_t enable) { #ifdef HRS_ALG_LIB hx3695_hrs_disable(); + hx3695_wearstatus_update(); #endif }else if(md == HRV_MODE) { -- 2.17.1