From 9bd5a206a79485b46eae9aa0cc1cfce49b88ff2e Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=83=A1=E4=BC=A0=E5=86=9B?= <1224667075@qq.com> Date: Sat, 7 Sep 2024 08:24:30 +0000 Subject: [PATCH] Merge #902 into sdk602patch0626 from refs/changes/902/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 胡传军 * refs/changes/902/head: (7 commits squashed) - 睡眠数据上传修改 - 修复goal界面图片位置异常bug - 电话 增加断连判断 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into 0626 - 修复活动历史数据BUG - 修复活动历史数据BUG(补 ) - 修复活动历史数据BUG(补2 ) Signed-off-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/902 --- .../drivers/peripheral/cywee/src/main_dml.c | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 2f92cd21b..74603685e 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -186,29 +186,22 @@ void cywee_get_version(char *databuf,uint8_t len) void cywee_save_data(void) { - stepcount+=history_step; - history_step=0; - CWM_OS_saveData(&stepcount,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); - - - new_calories+=history_calories; - history_calories=0; - CWM_OS_saveData(&(new_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_distance+=history_distances; - history_distances=0; - CWM_OS_saveData(&(new_distance),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_fat+=history_fat; - history_fat=0; - CWM_OS_saveData(&new_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); - } void cywee_restoreData(void) -- 2.17.1