修复运动数据存储 2458/1 2458/head 2459/target/1 2460/target/1 2461/target/1
authorpenglei <1624952103@qq.com>
Tue, 30 Sep 2025 10:08:17 +0000 (18:08 +0800)
committerpenglei <1624952103@qq.com>
Tue, 30 Sep 2025 10:08:17 +0000 (18:08 +0800)
code/sdk/zhihui/drivers/cywee/dml/cywee_data.c
code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c

index a665ae0..b3f6fca 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: penglei 1624952103@qq.com
  * @Date: 2024-04-08 14:53:31
  * @LastEditors: penglei 1624952103@qq.com
- * @LastEditTime: 2025-07-10 14:31:06
+ * @LastEditTime: 2025-09-30 18:03:35
  * @FilePath: /FD230/code/sdk/drivers/peripheral/cywee/service/cywee_dml.c
  * @Description: 
  * 
@@ -262,10 +262,10 @@ void cywee_save_data(void)
     }
     uapi_dev_runtime_set_goal_storage_status(1);
 
-    int step = cywee_get_sport_data(STEP) + cywee_get_sport_data(HISTORY_STEP);
-    int calories = cywee_get_sport_data(CALORIES) + cywee_get_sport_data(HISTORY_CALORIES);
-    int distances = cywee_get_sport_data(DISTANCE) + cywee_get_sport_data(HISTORY_DISTANCE);
-    int fat = cywee_get_sport_data(FAT) + cywee_get_sport_data(HISTORY_FAT);
+    int step = cywee_get_sport_data(STEP);
+    int calories = cywee_get_sport_data(NEW_CALORIES) + cywee_get_sport_data(HISTORY_CALORIES);
+    int distances = cywee_get_sport_data(NEW_DISTANCE) + cywee_get_sport_data(HISTORY_DISTANCE);
+    int fat = cywee_get_sport_data(NEW_FAT) + cywee_get_sport_data(HISTORY_FAT);
 
     int history_step_ = cywee_get_sport_data(HISTORY_STEP_);
     int history_calories_ = cywee_get_sport_data(HISTORY_CALORIES_);
@@ -303,6 +303,7 @@ void cywee_restoreData(void)
     CWM_OS_OneHourAgo_restoreData(&history_step_,sizeof(int),STEP);
     cywee_set_sport_data(history_step,HISTORY_STEP);
     cywee_set_sport_data(history_step_,HISTORY_STEP_);
+    cywee_set_sport_data(history_step,STEP);
 
     CWM_OS_restoreData(&history_calories,sizeof(int),CALORIES);
     CWM_OS_OneHourAgo_restoreData(&history_calories_,sizeof(float),CALORIES);
index a77313c..ab786e3 100644 (file)
@@ -893,6 +893,9 @@ void cywee_set_sport_data(uint32_t data,uint8_t type)
 {
     switch (type)
     {
+    case STEP:
+        stepcount = data;
+        break;
     case HISTORY_STEP:
         history_step  = data;
         break;
@@ -1619,7 +1622,7 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) {
                 CustomEventPublish(TOPIC_EVENT_AR_ALERT_TYPE_UPDATE,&ar_alert_type,sizeof(int)); 
                 
             }else{
-                stepcount = (int)sensorEVT->fData[1];
+                stepcount += (int)sensorEVT->fData[1];
                 memset(&c_act_result_t,0,sizeof(act_result_t));
                 c_act_result_t.activity_mode = (int)sensorEVT->fData[0];
                 c_act_result_t.steps = stepcount;