From: hcj <1224667075@qq.com> Date: Sat, 7 Sep 2024 02:09:31 +0000 (+0800) Subject: 修复活动历史数据BUG(补2 ) X-Git-Tag: release_V1.2.70_20241020_135402~526 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F902%2Fhead;p=mirrors%2FFD230.git 修复活动历史数据BUG(补2 ) --- 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)