Merge #3053 into fd272 from refs/changes/3053/head 3063/target/1
author彭磊 <1624952103@qq.com>
Fri, 9 Jan 2026 09:14:04 +0000 (09:14 +0000)
committer袁清梦 <3449750381@qq.com>
Fri, 9 Jan 2026 09:14:04 +0000 (09:14 +0000)
自动清除UI历史睡眠时间戳

* refs/changes/3053/head: (2 commits squashed)

  - 自动清除UI历史睡眠时间戳

  - 优化272心率突然掉0的情况(补)

Signed-off-by: aliyun6865282430 <1624952103@qq.com>
Merged-by: Caisking <3449750381@qq.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/3053
code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c
code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c

index e20c5c5..9ee3a7e 100644 (file)
@@ -343,6 +343,8 @@ static void clean_sleep_data(void)
     memset(status_file_path, 0, sizeof(status_file_path));
     memset(dir_path, 0, sizeof(dir_path));
     memset(nap_file_path, 0, sizeof(nap_file_path));
+    memset(&ui_nap_data, 0, sizeof(ui_nap_data));
+    memset(&ui_sleep_data, 0, sizeof(ui_nap_data));
     wake_up_flag = 0;
 }
 
index 3ae5fc6..4ba0937 100644 (file)
@@ -368,7 +368,7 @@ uint16_t hx3695_read_fifo_data(ppg_sensor_data_t *ppg_sensor_dat)
     uint16_t fifo_read_length = 0;\r
     uint16_t fifo_read_bytes = 0;\r
        uint16_t fifo_out_count = 0;\r
-\r
+    uint8_t retry_cnt = 0;\r
     data_len_h = hx3695_read_reg(0x21);\r
     data_len_l = hx3695_read_reg(0x20);\r
     fifo_data_length = (((data_len_h&0x01)<<8)|data_len_l);\r
@@ -388,13 +388,23 @@ uint16_t hx3695_read_fifo_data(ppg_sensor_data_t *ppg_sensor_dat)
 \r
     // printf("threshold : %d\n",threshold);\r
 \r
-       if(fifo_data_length > threshold)\r
-       {\r
-               data_len_h = hx3695_read_reg(0x21);\r
-       data_len_l = hx3695_read_reg(0x20);\r
-       fifo_data_length = (((data_len_h&0x01)<<8)|data_len_l);\r
-               // printf("222 fifo data length again %d %d %d\n", data_len_h, data_len_l, fifo_data_length);\r
-       }\r
+    if(fifo_data_length > threshold)\r
+    {\r
+        for(int i = 0 ; i < 3; i++)\r
+        {\r
+            data_len_h = hx3695_read_reg(0x21);\r
+            data_len_l = hx3695_read_reg(0x20);\r
+            fifo_data_length = (((data_len_h&0x01)<<8)|data_len_l);\r
+            // printf("222 fifo data length again %d %d %d\n", data_len_h, data_len_l, fifo_data_length);\r
+            if(fifo_data_length > threshold)\r
+            {\r
+                retry_cnt ++;\r
+            }\r
+            else\r
+                break;\r
+        }\r
+    }\r
+\r
 \r
     if (fifo_data_length>FIFO_DATA_LENGTH)\r
     {\r
@@ -417,6 +427,15 @@ uint16_t hx3695_read_fifo_data(ppg_sensor_data_t *ppg_sensor_dat)
 \r
        hx3695_get_led_para(ppg_sensor_dat);\r
 \r
+    if(retry_cnt >= 3)\r
+    {\r
+        if(work_mode_flag == WEAR_MODE)\r
+            fifo_out_count = 25;\r
+        else\r
+            fifo_out_count = 8;\r
+    }\r
+\r
+\r
     return fifo_out_count;\r
 }\r
 \r
@@ -501,11 +520,11 @@ void hx3695_software_reset(void)
        #endif\r
 }\r
 \r
-bool hx3695_check_wear(ppg_sensor_data_t *ppg_sensor_dat)\r
+bool hx3695_check_wear(ppg_sensor_data_t *ppg_sensor_dat,uint8_t count)\r
 {\r
     uint8_t ii = 0;\r
     \r
-    for(ii=0;ii<ppg_sensor_dat->led_data[3].data_count;ii++)\r
+    for(ii=0;ii<count;ii++)\r
     {\r
         if(ppg_sensor_dat->led_data[3].data_val[ii] > CHECK_WEAR_THRE)\r
         {\r
@@ -1570,7 +1589,7 @@ void hx3695_ppg_Int_handle(ppg_sensor_data_t *ppg_sensor_dat)
     // printf("count:%d\n",count);\r
     if(count > 0)\r
     {\r
-        hx3695_check_wear(ppg_sensor_dat);\r
+        hx3695_check_wear(ppg_sensor_dat,count);\r
         if(wear_status == MSG_WEAR)\r
         {\r
             hx3695_alg_send_data(ppg_sensor_dat,work_mode_flag,count);\r