From 4cd735e27367580ca01cf7e151c63e34f1f3e694 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Wed, 3 Jul 2024 18:18:39 +0800 Subject: [PATCH] =?utf8?q?=E8=A1=A5=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../msg_center/src/msg_center_customer.cpp | 28 +++++++++---------- .../drivers/peripheral/cywee/Inc/cywee_hal.h | 5 ++-- .../drivers/peripheral/cywee/src/main_dml.c | 2 ++ 3 files changed, 19 insertions(+), 16 deletions(-) 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 625779c52..67cf14278 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 @@ -1126,26 +1126,26 @@ void MsgCenterNotifyInactivityAccumulateTimeProc(const Topic topic, Request* req return; } - if(nap_data.wake_up_timestamp != 0) + if(cywee_Inactivity_Accumulate_Time_Info->output_number == INACTIVITY_MODE_NAP_ACCUMULATE_TIME_OUTPUT) { nap_data.total_time = cywee_Inactivity_Accumulate_Time_Info->total_time; set_nap_data(&nap_data); memset(&nap_data,0,sizeof(NAP_T)); - free(cywee_Inactivity_Accumulate_Time_Info); - cywee_Inactivity_Accumulate_Time_Info = NULL; - return ; + } + else if(cywee_Inactivity_Accumulate_Time_Info->output_number == INACTIVITY_MODE_SLEEPING_ACCUMULATE_TIME_OUTPUT) + { + sleep_data.total_time = cywee_Inactivity_Accumulate_Time_Info->total_time; + sleep_data.total_deep_sleep_time = cywee_Inactivity_Accumulate_Time_Info->total_deep_sleep_time; + sleep_data.total_mild_sleep_time = cywee_Inactivity_Accumulate_Time_Info->total_mild_sleep_time; + sleep_data.total_wake_time = cywee_Inactivity_Accumulate_Time_Info->total_wake_time; + sleep_data.total_rem_sleep_time = cywee_Inactivity_Accumulate_Time_Info->total_rem_sleep_time; + sleep_data.status_num = state_num; + + set_sleep_data(&sleep_data); + memset(&sleep_data,0,sizeof(SLEEP_T)); + state_num = 0; } - sleep_data.total_time = cywee_Inactivity_Accumulate_Time_Info->total_time; - sleep_data.total_deep_sleep_time = cywee_Inactivity_Accumulate_Time_Info->total_deep_sleep_time; - sleep_data.total_mild_sleep_time = cywee_Inactivity_Accumulate_Time_Info->total_mild_sleep_time; - sleep_data.total_wake_time = cywee_Inactivity_Accumulate_Time_Info->total_wake_time; - sleep_data.total_rem_sleep_time = cywee_Inactivity_Accumulate_Time_Info->total_rem_sleep_time; - sleep_data.status_num = state_num; - - set_sleep_data(&sleep_data); - memset(&sleep_data,0,sizeof(SLEEP_T)); - state_num = 0; free(cywee_Inactivity_Accumulate_Time_Info); cywee_Inactivity_Accumulate_Time_Info = NULL; } diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h index f9d8d538d..606773616 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h @@ -62,9 +62,9 @@ extern void CWM_OS_restoreData(int* data, uint32_t len,uint8_t type); #define INACTIVITY_MODE_SEDENTARY_OUTPUT 20 // 久坐和有效站立 #define INACTIVITY_MODE_SLEEPING_OUTPUT 21 // 睡眠 -#define INACTIVITY_MODE_SLEEPING_ACCUMULATE_TIME_OUTPUT 31 // 久坐、有效站立和小睡 #define INACTIVITY_MODE_NAP_OUTPUT 22 // 小睡 -#define INACTIVITY_MODE_NAP_ACCUMULATE_TIME_OUTPUT 32 +#define INACTIVITY_MODE_SLEEPING_ACCUMULATE_TIME_OUTPUT 31 // 睡眠累计 +#define INACTIVITY_MODE_NAP_ACCUMULATE_TIME_OUTPUT 32 // 小睡累计 #pragma pack(1) @@ -490,6 +490,7 @@ typedef struct typedef struct { + int output_number; int total_time;//总共睡眠时间 int total_mild_sleep_time;//总共浅睡时间 int total_deep_sleep_time;//总共深睡时间 diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 3bab5bf2a..a0711d055 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -663,6 +663,7 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { memset(&c_inactivity_accumulate_time_t,0,sizeof(cywee_inactivity_accumulate_time_t)); + c_inactivity_accumulate_time_t.output_number = (int)sensorEVT->fData[0]; c_inactivity_accumulate_time_t.total_time = (int)sensorEVT->fData[1]; c_inactivity_accumulate_time_t.total_mild_sleep_time = (int)sensorEVT->fData[2]; c_inactivity_accumulate_time_t.total_deep_sleep_time = (int)sensorEVT->fData[3]; @@ -688,6 +689,7 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { memset(&c_inactivity_accumulate_time_t,0,sizeof(cywee_inactivity_accumulate_time_t)); + c_inactivity_accumulate_time_t.output_number = (int)sensorEVT->fData[0]; c_inactivity_accumulate_time_t.total_time = (int)sensorEVT->fData[1]; c_inactivity_accumulate_time_t.total_mild_sleep_time = (int)sensorEVT->fData[2]; c_inactivity_accumulate_time_t.total_deep_sleep_time = (int)sensorEVT->fData[3]; -- 2.17.1