From cf7918fd8425697d1ad04344c4616aaa9205b7ad Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Sat, 7 Sep 2024 10:09:31 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E6=B4=BB=E5=8A=A8=E5=8E=86?= =?utf8?q?=E5=8F=B2=E6=95=B0=E6=8D=AEBUG=EF=BC=88=E8=A1=A52=20=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../drivers/peripheral/cywee/src/main_dml.c | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 3efe3cae9..d940221aa 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -186,25 +186,22 @@ void cywee_get_version(char *databuf,uint8_t len) void cywee_save_data(void) { - history_step+=stepcount; - CWM_OS_saveData(&history_step,sizeof(int),CYWEE_SAVE_DATA_STEP); + int step=history_step+stepcount; + CWM_OS_saveData(&step,sizeof(int),CYWEE_SAVE_DATA_STEP); CWM_OS_OneHourAgo_saveData(&history_step_,sizeof(int),CYWEE_SAVE_DATA_STEP); - stepcount=0; - history_calories+=new_calories; - CWM_OS_saveData(&(history_calories),sizeof(int),CYWEE_SAVE_DATA_CALORIES); + int calories=history_calories+new_calories; + CWM_OS_saveData(&(calories),sizeof(int),CYWEE_SAVE_DATA_CALORIES); CWM_OS_OneHourAgo_saveData(&history_calories_,sizeof(float),CYWEE_SAVE_DATA_CALORIES); - new_calories=0; - history_distances+=new_distance; - CWM_OS_saveData(&(history_distances),sizeof(int),CYWEE_SAVE_DATA_DISTANCE); + int distances=history_distances+new_distance; + CWM_OS_saveData(&(distances),sizeof(int),CYWEE_SAVE_DATA_DISTANCE); CWM_OS_OneHourAgo_saveData(&history_distances_,sizeof(float),CYWEE_SAVE_DATA_DISTANCE); - new_distance=0; + - history_fat+=new_fat; - CWM_OS_saveData(&history_fat,sizeof(int),CYWEE_SAVE_DATA_FAT); + int fat=history_fat+new_fat; + CWM_OS_saveData(&fat,sizeof(int),CYWEE_SAVE_DATA_FAT); CWM_OS_OneHourAgo_saveData(&history_fat_,sizeof(uint16_t),CYWEE_SAVE_DATA_FAT); - new_fat=0; } void cywee_restoreData(void) -- 2.17.1