每日目标,燃脂数据修改,增加获取站立次数 563/1
authorhcj <1224667075@qq.com>
Sat, 20 Jul 2024 08:01:18 +0000 (16:01 +0800)
committerhcj <1224667075@qq.com>
Sat, 20 Jul 2024 08:01:18 +0000 (16:01 +0800)
code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp
code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp
code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h
code/sdk/drivers/peripheral/cywee/src/board_yh601s.c
code/sdk/drivers/peripheral/cywee/src/main_dml.c

index 8d3f95a..1067a9c 100644 (file)
@@ -106,7 +106,7 @@ namespace OHOS
    char fatburningnewstr[20];
    char *GoalModel::getfatburningnew()
    {
-      int fatburningdata = 0;
+      int fatburningdata = get_fat_time_data()/60;
 
       memset((void *)fatburningnewstr, 0, 20);
       sprintf_s(fatburningnewstr, 20, "%d", fatburningdata);
@@ -125,7 +125,7 @@ namespace OHOS
    char standnewstr[20];
    char *GoalModel::getstandnew()
    {
-      int standdata = 0;
+      int standdata = get_now_stand_count();
 
       memset((void *)standnewstr, 0, 20);
       sprintf_s(standnewstr, 20, "%d", standdata);
index 7dbea44..d9bff33 100644 (file)
@@ -716,7 +716,7 @@ char * ble_sywee_history(uint8_t day,uint16_t *len ,uint8_t type)
                 {
                     memcpy(buf+size,&creationTime,4);
                     size+=4;
-                    uint16 temp_value= value;
+                    uint16 temp_value= (value/60);
                     memcpy(buf+size,&(temp_value),2);
                     size+=2;
                 }
index f9538fa..743aa27 100644 (file)
@@ -42,6 +42,7 @@ extern  void CWM_OS_OneHourAgo_saveData(int* data, uint32_t len,uint8_t type);
 
 extern void CWM_OS_saveData_history(int* new_data,int *history ,uint32_t len,uint8_t type);
 extern void CWM_OS_saveData_STAND_history(uint8_t *falg,uint32_t len);
+extern uint8_t get_stand_count(void);
 extern void CWM_OS_restoreData(int* data, uint32_t len,uint8_t type);
 extern void CWM_OS_OneHourAgo_restoreData(int* data, uint32_t len,uint8_t type);
 
@@ -544,6 +545,7 @@ void cywee_goal_history_save(void);
 
 void set_stand_falg(void);
 uint8_t get_stand_falg(void);
+uint8_t get_now_stand_count(void);
 void set_calories_data(uint32_t data);
 int get_calories_data(void);
 
@@ -551,6 +553,7 @@ void set_distance_data(uint32_t data);
 int get_distance_data(void );
 
 void set_fat_time_data(void);
+int get_fat_time_data(void);
 
 void cywee_get_chipinfo(char *databuf,uint8_t len);
 void cywee_set_sedentary_interval(int time);
index 474e6fd..9a3e6da 100644 (file)
@@ -521,8 +521,31 @@ void CWM_OS_saveData_STAND_history(uint8_t *falg,uint32_t len){
 }
   // calories 数据存储
 
+uint8_t get_stand_count(void)
+{
+    char path_[64]={0};
+    char timeday[12] = {0};
+    uapi_get_YYMMDD_Time(timeday, '_');
 
 
+    sprintf_s(path_,64,"%s%s.bin",CWM_HISTORY_STAND_DATA_PATH,timeday);
+    CWM_OS_dbgPrintf(" save path %s \n",path_);
+
+    FILE * fp = fopen(path_,"rb+");
+    if(fp==NULL)
+    {
+        CWM_OS_dbgPrintf("open fail\n");
+        return 0;
+    }
+    fseek(fp, 0, SEEK_END);
+    uint8_t size = ftell(fp);
+    fseek(fp, 0, SEEK_SET);
+    
+    fclose(fp);
+    return size/4;
+
+}
+
 
 
 void CWM_OS_restoreData(int* data, uint32_t len,uint8_t type){
index cbdea31..0890994 100644 (file)
@@ -209,6 +209,10 @@ uint8_t get_stand_falg(void)
     return stand_falg;
 }
 
+uint8_t get_now_stand_count(void)
+{
+    return get_stand_count()+stand_falg;
+}
 void stand_history_save(void)
 {
     CWM_OS_saveData_STAND_history(&stand_falg,sizeof(int));
@@ -237,7 +241,8 @@ void distances_history_save(void)
 
 void fat_history_save(void)
 {
-     int data= get_fat_time_data();
+    int data= get_fat_time_data();
+    data=data/60;
     CWM_OS_saveData_history(&data,&history_fat_,sizeof(uint16_t),CYWEE_SAVE_DATA_FAT);
 }