From 79e75b7b42b825485957a8a36e7298417c1a7d2c Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Sat, 20 Jul 2024 16:01:18 +0800 Subject: [PATCH] =?utf8?q?=E6=AF=8F=E6=97=A5=E7=9B=AE=E6=A0=87=EF=BC=8C?= =?utf8?q?=E7=87=83=E8=84=82=E6=95=B0=E6=8D=AE=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?utf8?q?=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96=E7=AB=99=E7=AB=8B=E6=AC=A1?= =?utf8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../fd230app/nativeui/goal/src/goalmodel.cpp | 4 ++-- .../service/ble_service/blemoder/bletest.cpp | 2 +- .../drivers/peripheral/cywee/Inc/cywee_hal.h | 3 +++ .../peripheral/cywee/src/board_yh601s.c | 23 +++++++++++++++++++ .../drivers/peripheral/cywee/src/main_dml.c | 7 +++++- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp index 8d3f95a70..1067a9cd0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp @@ -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); diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index 7dbea4432..d9bff3395 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -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; } diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h index f9538fa62..743aa2759 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h @@ -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); diff --git a/code/sdk/drivers/peripheral/cywee/src/board_yh601s.c b/code/sdk/drivers/peripheral/cywee/src/board_yh601s.c index 474e6fdd2..9a3e6da62 100644 --- a/code/sdk/drivers/peripheral/cywee/src/board_yh601s.c +++ b/code/sdk/drivers/peripheral/cywee/src/board_yh601s.c @@ -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){ diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index cbdea312d..0890994ef 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -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); } -- 2.17.1