From: 1624952103 Date: Tue, 3 Feb 2026 09:29:09 +0000 (+0800) Subject: 增加电量存储,降低PPG GPS线程优先级 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=c4535a184cdaf214ba4f2ce709fda45832980483;p=mirrors%2FFD230.git 增加电量存储,降低PPG GPS线程优先级 --- diff --git a/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c b/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c index 0caf087ac..ab59a314c 100644 --- a/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c +++ b/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c @@ -1296,6 +1296,8 @@ void cywee_activity_mode_change(int mode) else cywee_sport_timer_stop_check(); + last_fat_burn_timestamp = 0; + if(mode == SPORT_ACTIVE_MODE_FREE_TRAINING) is_free_trainning_mode = 1; else diff --git a/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c b/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c index 87073c9b7..bbc12d907 100644 --- a/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c +++ b/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c @@ -548,13 +548,35 @@ bool hx3695_check_wear(ppg_sensor_data_t *ppg_sensor_dat,uint8_t count) if(uapi_dev_runtime_get_train_status() && !wear_status) avg_hrs = 0; - if(living_status != 2) + wear_status_pre = wear_status; + + if(uapi_dev_runtime_get_sleep_monitoring_status()) { - wear_status_pre = wear_status; -#ifdef SUPPORT_CYWEE_SERVICE - cywee_wear_status_update(&wear_status); -#endif + if(!wear_status) + { + #ifdef SUPPORT_CYWEE_SERVICE + cywee_wear_status_update(&wear_status); + #endif + } + else if(living_status == 1 && wear_status) + { + #ifdef SUPPORT_CYWEE_SERVICE + cywee_wear_status_update(&wear_status); + #endif + } + } + else + { + if(living_status != 2) + { + + #ifdef SUPPORT_CYWEE_SERVICE + cywee_wear_status_update(&wear_status); + #endif + } } + + // printf("wear_status:%d\n",wear_status); if(!uapi_dev_runtime_get_factory_test_status_flag()) @@ -1449,6 +1471,9 @@ void hx3695_alg_send_data(ppg_sensor_data_t *ppg_sensor_dat, WORK_MODE_T mode, u get_avg_hrs(hrs_result.hr_result); living_status = 1; + #ifdef SUPPORT_CYWEE_SERVICE + cywee_wear_status_update(&living_status); + #endif } else if(hrs_result.living_status == MSG_LIVING_FAIL) { @@ -1459,7 +1484,11 @@ void hx3695_alg_send_data(ppg_sensor_data_t *ppg_sensor_dat, WORK_MODE_T mode, u living_status = 2; wear_status = 0; wear_status_pre = 0; - hx3695_unwearstatus_update(); + // hx3695_unwearstatus_update(); + + #ifdef SUPPORT_CYWEE_SERVICE + cywee_wear_status_update(&living_status); + #endif living_wear_cnt = 0; } } diff --git a/code/sdk/zhihui/drivers/ppg/service/ppg_service.cpp b/code/sdk/zhihui/drivers/ppg/service/ppg_service.cpp index d87261d91..cf3beb626 100644 --- a/code/sdk/zhihui/drivers/ppg/service/ppg_service.cpp +++ b/code/sdk/zhihui/drivers/ppg/service/ppg_service.cpp @@ -47,7 +47,7 @@ static uint8_t keep_in_wear_det_mod = 1; //持续坚持 佩戴检测模式 void set_keep_in_wear_det_mode(uint8_t mod) { - keep_in_wear_det_mod = mod; + // keep_in_wear_det_mod = mod; } void uapi_ppg_service_deinit(void) @@ -229,7 +229,7 @@ errcode_t uapi_ppg_service_init(void) taskcfg.create_queue_handle = create_ppg_queue; taskcfg.attr.name="ppg_service"; - taskcfg.attr.priority = osPriorityAboveNormal3; + taskcfg.attr.priority = osPriorityAboveNormal2; taskcfg.attr.stack_size = PPG_SERVICE_TASK_SIZE; taskcfg.func = ppg_service_check_task; diff --git a/code/sdk/zhihui/services/battery/service/battery_driver.cpp b/code/sdk/zhihui/services/battery/service/battery_driver.cpp index ed64085bb..0e9c027c5 100644 --- a/code/sdk/zhihui/services/battery/service/battery_driver.cpp +++ b/code/sdk/zhihui/services/battery/service/battery_driver.cpp @@ -83,14 +83,14 @@ typedef enum { #pragma pack(1) typedef struct { - // float avg_vol = 0; + float avg_vol = 0; float sum_vol = 0; uint8_t vol_num = 0; float history_data[AVG_VOLTAGE_COUNT] = {0}; int left = 0; int right = -1; uint32_t time = 0; - // uint8_t percent = 0; + uint8_t percent = 0; } BAT_VOL_T; #pragma pack() @@ -524,20 +524,20 @@ void battery_save_vol(void) uapi_get_timestampe_ss(&time); for(int i = 0; i < bat_vol.vol_num;i++) { - // printf("history_data[%d]:%.3f\n",i,bat_vol.history_data[i]); + printf("history_data[%d]:%.3f\n",i,bat_vol.history_data[i]); if(bat_vol.history_data[i] < 3.3 || bat_vol.history_data[i] > 4.45) bat_vol.history_data[i] = 0; } bat_vol.time = time; - // bat_vol.percent = cur_percent; + bat_vol.percent = cur_percent; uapi_save_file_data("/user/userdata/battery.bin",(uint8_t *)&bat_vol,sizeof(BAT_VOL_T),"wb"); // uapi_save_file_data("/user/userdata/battery_time.bin",(uint8_t *)&time,sizeof(uint32_t),"wb"); } void battery_restore_vol(void) { - // float cur_vol = 0; + float cur_vol = 0; uint32_t time = 0; uint16_t len = sizeof(BAT_VOL_T); @@ -563,10 +563,10 @@ void battery_restore_vol(void) return; } - // batteryservice_get_voltage_by_channel(&cur_vol,ADC_CHANNEL_BAT_VOLTAGE); + batteryservice_get_voltage_by_channel(&cur_vol,ADC_CHANNEL_BAT_VOLTAGE); - // if(bat_vol.percent > 0 && bat_vol.percent<=100 && (fabsf(cur_vol - bat_vol.avg_vol) < 0.15)) - // history_percent = bat_vol.percent; + if(bat_vol.percent > 0 && bat_vol.percent<=100 && (fabsf(cur_vol - bat_vol.avg_vol) < 0.15)) + history_percent = bat_vol.percent; // for(int i = 0; i < AVG_VOLTAGE_COUNT;i++) // { // printf("history_data[%d]:%.3f\n",i,bat_vol.history_data[i]); @@ -576,15 +576,15 @@ void battery_restore_vol(void) // } // } - // printf("bat_vol.percent:%d,cur_vol:%.3f,bat_vol.avg_vol:%.3f\n",bat_vol.vol_num,cur_vol,bat_vol.avg_vol); + printf("bat_vol.percent:%d,cur_vol:%.3f,bat_vol.avg_vol:%.3f\n",bat_vol.vol_num,cur_vol,bat_vol.avg_vol); - // printf("vol_num:%d\n",bat_vol.vol_num); + printf("vol_num:%d\n",bat_vol.vol_num); } void battery_percent_init(uint8_t percent) { percernt_installized = 1; - history_percent = percent; + // history_percent = percent; } battery_info_t *get_current_battery_info(void) @@ -876,7 +876,7 @@ static void get_avg_voltage(float *vol) for (int i = 0;i < bat_vol.vol_num; i++) { - // PRINT("333history_data[%d] : %.3f\n",i,bat_vol.history_data[i]); + PRINT("333history_data[%d] : %.3f\n",i,bat_vol.history_data[i]); if (bat_vol.history_data[i] < min_vol) min_vol = bat_vol.history_data[i]; if (bat_vol.history_data[i] > max_vol) @@ -884,14 +884,14 @@ static void get_avg_voltage(float *vol) } - // bat_vol.avg_vol = (bat_vol.sum_vol - max_vol - min_vol) / (bat_vol.vol_num - 2); - // printf("avg_vol : %.3f\n",bat_vol.avg_vol); - *vol = (bat_vol.sum_vol - max_vol - min_vol) / (bat_vol.vol_num - 2); + bat_vol.avg_vol = (bat_vol.sum_vol - max_vol - min_vol) / (bat_vol.vol_num - 2); + printf("avg_vol : %.3f\n",bat_vol.avg_vol); + // *vol = (bat_vol.sum_vol - max_vol - min_vol) / (bat_vol.vol_num - 2); // printf("avg_vol : %.3f\n",*vol); } - else - *vol = bat_vol.sum_vol / bat_vol.vol_num; - // bat_vol.avg_vol = bat_vol.sum_vol / bat_vol.vol_num; + else + bat_vol.avg_vol = bat_vol.sum_vol / bat_vol.vol_num; + // *vol = bat_vol.sum_vol / bat_vol.vol_num; } } @@ -957,7 +957,7 @@ static bool adc_get_sample_result(float *voltage, uint8_t channel) int DecimalPart_1 = (int)(DecimalPart / 100); int DecimalPart_2 = (int)((DecimalPart % 100) / 10); int DecimalPart_3 = (int)(DecimalPart % 10); - // PRINT("222*voltage : %.3f \n",*voltage); + PRINT("222*voltage : %.3f \n",*voltage); // PRINT("DecimalPart_1 : %d , DecimalPart_2 : %d DecimalPart_3 : %d \n",DecimalPart_1,DecimalPart_2,DecimalPart_3); uint16_t value = DecimalPart_1 << 8 | DecimalPart_2 << 4 | DecimalPart_3 << 0; @@ -975,8 +975,8 @@ static bool adc_get_sample_result(float *voltage, uint8_t channel) } else { - // cur_percent = battery_get_percent_by_voltage(bat_vol.avg_vol); - cur_percent = battery_get_percent_by_voltage(*voltage); + cur_percent = battery_get_percent_by_voltage(bat_vol.avg_vol); + // cur_percent = battery_get_percent_by_voltage(*voltage); } } diff --git a/code/sdk/zhihui/services/gnss/src/uart_gnss.c b/code/sdk/zhihui/services/gnss/src/uart_gnss.c index e1da2fc0e..7909d9ed7 100644 --- a/code/sdk/zhihui/services/gnss/src/uart_gnss.c +++ b/code/sdk/zhihui/services/gnss/src/uart_gnss.c @@ -238,7 +238,7 @@ int gnss_uart_init(void) app_task_definition_t taskcfg={0}; taskcfg.create_queue_handle = create_gnss_uart_queue; taskcfg.attr.name="uart_gnss_service"; - taskcfg.attr.priority = osPriorityAboveNormal2;//osPriorityNormal; GUI osPriorityAboveNormal2 + taskcfg.attr.priority = osPriorityAboveNormal1;//osPriorityNormal; GUI osPriorityAboveNormal2 taskcfg.attr.stack_size = GNSS_CMD_TASK_SIZE; taskcfg.func = uart_event_task; taskcfg.use_mem = USE_EXTEND_MEM;