From: penglei <1624952103@qq.com> Date: Wed, 21 Aug 2024 03:12:28 +0000 (+0800) Subject: 优化睡眠模式时间戳计算,不使用心率数据输入睡眠算法。 X-Git-Tag: release_V1.2.70_20241020_135402~612^2~2^2~3 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=d31e58c131e53a4453d237e6d87ba3c21e806260;p=mirrors%2FFD230.git 优化睡眠模式时间戳计算,不使用心率数据输入睡眠算法。 --- diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index a36b74a77..3fec2b49a 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -1204,21 +1204,37 @@ void MsgCenterNotifyInactivityProc(const Topic topic, Request *req) //睡眠 case INACTIVITY_MODE_SLEEPING_OUTPUT: #ifdef FD230 + // if(state_num < 20) + // { + // sleep_data.sleep_status[state_num].timestamp = day_timestamp + cywee_Inactivity_Info->hour * 60 * 60 + cywee_Inactivity_Info->minute * 60; + // sleep_data.sleep_status[state_num].stat = cywee_Inactivity_Info->status; + // state_num ++; + // } + // if(cywee_Inactivity_Info->status == 0) //0进入睡眠 1潜睡 2深睡 3清醒 4结束睡眠 6入睡 7出睡最后一笔输出 8未出睡最后一笔输出 12快速动眼 13取消入睡 + // { + // sleep_data.fall_asleep_timestamp = day_timestamp + cywee_Inactivity_Info->hour * 60 * 60 + cywee_Inactivity_Info->minute * 60; + // fall_asleep_state_num = state_num; + // } + // else if(cywee_Inactivity_Info->status == 4) + // { + // sleep_data.wake_up_timestamp = day_timestamp + cywee_Inactivity_Info->hour * 60 * 60 + cywee_Inactivity_Info->minute * 60; + // } if(state_num < 20) { sleep_data.sleep_status[state_num].timestamp = day_timestamp + cywee_Inactivity_Info->hour * 60 * 60 + cywee_Inactivity_Info->minute * 60; sleep_data.sleep_status[state_num].stat = cywee_Inactivity_Info->status; - fall_asleep_state_num = state_num; + + if(sleep_data.sleep_status[state_num].stat == 0) //0进入睡眠 1潜睡 2深睡 3清醒 4结束睡眠 6入睡 7出睡最后一笔输出 8未出睡最后一笔输出 12快速动眼 13取消入睡 + { + sleep_data.fall_asleep_timestamp = sleep_data.sleep_status[state_num].timestamp; + fall_asleep_state_num = state_num; + } + else if(sleep_data.sleep_status[state_num].stat == 4) + { + sleep_data.wake_up_timestamp = sleep_data.sleep_status[state_num].timestamp; + } state_num ++; } - if(cywee_Inactivity_Info->status == 0) //0进入睡眠 1潜睡 2深睡 3清醒 4结束睡眠 6入睡 7出睡最后一笔输出 8未出睡最后一笔输出 12快速动眼 13取消入睡 - { - sleep_data.fall_asleep_timestamp = day_timestamp + cywee_Inactivity_Info->hour * 60 * 60 + cywee_Inactivity_Info->minute * 60; - } - else if(cywee_Inactivity_Info->status == 4) - { - sleep_data.wake_up_timestamp = day_timestamp + cywee_Inactivity_Info->hour * 60 * 60 + cywee_Inactivity_Info->minute * 60; - } #endif break; diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 6059fc2d2..f8d173e19 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -514,7 +514,7 @@ void cywee_inactivity_mode_change(int mode) //设置睡眠 memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; - scl.iData[2] = 1; // 0.不使用心率 1.使用心率 (暂时关闭,不使用心率数据输入算法) + scl.iData[2] = 0; // 0.不使用心率 1.使用心率 (暂时关闭,不使用心率数据输入算法) CWM_SettingControl(SCL_SLEEP_CONFIG, &scl); memset(&scl, 0, sizeof(scl)); diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index fb706a58a..ef80e512a 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -2727,7 +2727,7 @@ static void get_avg_hrs(int32_t hrs) } -void hx3695_hrs_wearstatus_update(void) +void hx3695_wearstatus_update(void) { if(wear_status != hrsresult.wearstatus) { @@ -2735,11 +2735,6 @@ void hx3695_hrs_wearstatus_update(void) cywee_data = wear_status; do_cywee_service_check_msg(CYWEE_SERVICE_CMD_WEAR_STATUS_CHANGE,&cywee_data); } - if(wear_status) - cywee_data = hrsresult.lastesthrs; - else - cywee_data = 0; - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_HRS_CHANGE,&cywee_data); } #ifdef HRS_ALG_LIB diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h index bf2d8d59b..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_hrs_wearstatus_update(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 b0d032ceb..1d1690049 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-08-17 11:11:47 + * @LastEditTime: 2024-08-21 11:07:20 * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c * @Description: * @@ -76,7 +76,7 @@ void ppg_send_cmd_to_driver(char* mode, uint8_t enable) { #ifdef HRS_ALG_LIB hx3695_hrs_disable(); - hx3695_hrs_wearstatus_update(); + hx3695_wearstatus_update(); #endif }else if(md == HRV_MODE) {