From 00b009d69e77ce7559b20332a6d47bf91a354e07 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Thu, 8 Jan 2026 16:39:24 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96272=E5=BF=83=E7=8E=87=E7=AA=81?= =?utf8?q?=E7=84=B6=E6=8E=890=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c | 35 ++++++++++++++++----- 1 file changed, 28 insertions(+), 7 deletions(-) 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; -- 2.17.1