From: penglei <1624952103@qq.com> Date: Thu, 8 Jan 2026 08:39:24 +0000 (+0800) Subject: 优化272心率突然掉0的情况 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F3056%2Ftarget%2F1;p=mirrors%2FFD230.git 优化272心率突然掉0的情况 --- diff --git a/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c b/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c index 3a28e43e2..3ae5fc629 100644 --- a/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c +++ b/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c @@ -372,14 +372,35 @@ uint16_t hx3695_read_fifo_data(ppg_sensor_data_t *ppg_sensor_dat) data_len_h = hx3695_read_reg(0x21); data_len_l = hx3695_read_reg(0x20); fifo_data_length = (((data_len_h&0x01)<<8)|data_len_l); + // printf("111 fifo data length %d %d %d\n", data_len_h, data_len_l, fifo_data_length); + // DEBUG_PRINTF("fifo_data_length: %d\r\n", fifo_data_length); - DEBUG_PRINTF("fifo_data_length: %d\r\n", fifo_data_length); - - if (fifo_data_length>FIFO_DATA_LENGTH) - { - fifo_data_length = FIFO_DATA_LENGTH; - } - + int threshold = 0; + + if(work_mode_flag == WEAR_MODE) + { + threshold = (ppg_sensor_dat->led_activated)*(ppg_sensor_dat->fs/5)*40; + } + else + { + threshold = (ppg_sensor_dat->led_activated)*(ppg_sensor_dat->fs/5)*4; + } + + // printf("threshold : %d\n",threshold); + + if(fifo_data_length > threshold) + { + data_len_h = hx3695_read_reg(0x21); + data_len_l = hx3695_read_reg(0x20); + fifo_data_length = (((data_len_h&0x01)<<8)|data_len_l); + // printf("222 fifo data length again %d %d %d\n", data_len_h, data_len_l, fifo_data_length); + } + + if (fifo_data_length>FIFO_DATA_LENGTH) + { + fifo_data_length = FIFO_DATA_LENGTH; + } + if(fifo_data_length<2*ppg_sensor_dat->led_activated) { return 0;