心率:增加心率传感器的开启与关闭的错误记录
authorCaisking <3449750381@qq.com>
Mon, 30 Dec 2024 07:14:56 +0000 (15:14 +0800)
committerCaisking <3449750381@qq.com>
Mon, 30 Dec 2024 07:14:56 +0000 (15:14 +0800)
code/sdk/drivers/peripheral/ppg/hx3695/hx3695_factory_test.h
code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp
code/sdk/drivers/peripheral/utils/custom_save_runtime.h

index 7abd190..aadb903 100644 (file)
@@ -37,7 +37,7 @@ FT_RESULTS_t hx3695_factroy_test(TEST_MODE_t  test_mode);
 \r
 void hx3695_lab_test(uint32_t  test_mode);\r
 void hx3695_lab_test_read(void);\r
-\r
+bool hx3695_chip_check_id(void);\r
 \r
 #endif // _HX3695_FACTORY_TEST_H_\r
 \r
index 508e259..f5014ef 100644 (file)
@@ -49,6 +49,7 @@ extern "C" {
 #include "cywee_service.h"
 #include "custom_runtime.h"
 #include "custom_save_runtime.h"
+#include "hx3695_factory_test.h"
 
 static bool g_ppg_service_initialled = false;
 
@@ -238,15 +239,19 @@ uint32_t ppg_resume(void)
 errcode_t send_ppg_cmd_msg(int cmd)
 {
     errcode_t ret;
-    if (ppg_sensor_exist == false)
+    if (ppg_sensor_exist == false) {
+        uapi_save_runtime_log(RUNTIME_LOG_HEART_EXIST_ERROR);
         return OSAL_FAILURE;
+    }
 
     PPG_CMD_TYPE_T mail = 0;
     mail = cmd;
     ret = osal_msg_queue_write_copy(g_app_queue, (void *)&mail,
                                     sizeof(PPG_CMD_TYPE_T), 0);
     if (ret != OSAL_SUCCESS) {
-        PRINT_ERR("Error ppg Check MSG 0x%02X send failed! err=0x%x! \r\n",cmd, ret);
+      PRINT_ERR("Error ppg Check MSG 0x%02X send failed! err=0x%x! \r\n", cmd,
+                ret);
+      uapi_save_runtime_log(RUNTIME_LOG_HEART_MSG_ERROR);
     }
     return ret;
 }
@@ -393,7 +398,7 @@ errcode_t uapi_ppg_service_init(void)
 
 #ifdef PPG_HX3695
     tyhx_poweron();
-    if ( hx3695_chip_check() == false)
+    if ( hx3695_chip_check_id() == false)
     {
         //TODO 没找到3695,退出线程
         PRINT("3695 not exist!\r\n");
index d9f897b..cdd0708 100644 (file)
@@ -152,6 +152,10 @@ extern "C"
     RUNTIME_LOG_HEART_VALID_VALUE,
     //获取到1个未佩戴值
     RUNTIME_LOG_HEART_NOT_WEAR,
+    //心率msg接收失败
+    RUNTIME_LOG_HEART_MSG_ERROR,
+    //心率sensor不存在
+    RUNTIME_LOG_HEART_EXIST_ERROR,
     /*******************************/
 
     // 佩戴