From a1fd47078363bc46f8669dbba8fdb85360209970 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Thu, 21 Nov 2024 22:00:57 +0800 Subject: [PATCH] =?utf8?q?=E7=87=83=E8=84=82=E6=97=B6=E9=97=B4=E6=95=B0?= =?utf8?q?=E6=8D=AE=E5=AD=98=E5=82=A8=E5=A2=9E=E5=8A=A0=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../service/msg_center/src/msg_center_customer.cpp | 4 ++-- code/sdk/drivers/peripheral/cywee/src/main_dml.c | 13 ++++++++++--- code/sdk/drivers/peripheral/utils/custom_utils.c | 3 ++- 3 files changed, 14 insertions(+), 6 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 594d00e7c..e64a62393 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 @@ -373,9 +373,9 @@ void MsgCenterNotifyONtimeProc(const Topic topic, Request* req) { unused(req); // The alarm notification is not displayed if the incoming call notification is already being processed - // cywee_save_data(); + cywee_save_data(); - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_SAVE_DATA,NULL); +// do_cywee_service_check_msg(CYWEE_SERVICE_CMD_SAVE_DATA,NULL); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时步数"); step_history_save(); diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 4cba1a04f..fb9644fb8 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -652,9 +652,14 @@ void distances_history_save(void) void fat_history_save(void) { int data= get_fat_time_data(); - uint16_t temp_data=0; + int16_t temp_data=0; temp_data = data / 60; // CWM_OS_dbgPrintf("history_fat is saving\n"); + if(temp_data-history_fat_>60 || temp_data-history_fat_<0) + { + history_fat_=0; + return; + } CWM_OS_saveData_history(&temp_data,&history_fat_,sizeof(uint16_t),CYWEE_SAVE_DATA_FAT); } @@ -691,7 +696,7 @@ int32_t get_now_hour_data(void*value, uint8_t type) case CYWEE_SAVE_DATA_FAT: data= get_fat_time_data(); data_=data/60-history_fat_; - if(data_<0) + if(data_<0 || data_>60) return 0; memcpy_s(value,2,&data_,2); return 1; @@ -734,11 +739,13 @@ void cywee_reset_history_daily_data(void) new_distance=0; new_fat=0; new_calories=0; + history_step = 0; history_calories=0; //卡路里数据 history_distances=0; //历史数据 history_fat=0; //历史燃脂数据 - new_fat = 0; //当前燃脂数据 + + // new_fat = 0; //当前燃脂数据 } void cywee_reset_daily_data(void) diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index 964a930ac..d28404672 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -274,7 +274,8 @@ void shutdown_reboot_prejobs_task(void) uapi_save_time_of_day(); //保存步数 - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_SAVE_DATA,NULL); + // do_cywee_service_check_msg(CYWEE_SERVICE_CMD_SAVE_DATA,NULL); + cywee_save_data(); // addressbookTowrite();//同步数据存储 -- 2.17.1