N9适配应用层血氧检测 2776/1 2776/head 2777/target/1
authorCaisking <Casiking@zhihuishixun.com>
Thu, 20 Nov 2025 10:09:13 +0000 (18:09 +0800)
committerCaisking <Casiking@zhihuishixun.com>
Thu, 20 Nov 2025 10:09:13 +0000 (18:09 +0800)
code/sdk/application/wearable/n9/nativeapp/nativeui/bloodoxygen/src/BloodOxygenModel.cpp

index e6d67c4..2e58ded 100644 (file)
@@ -227,13 +227,20 @@ void BloodOxygenModel::SetWearStatus(int32_t wear) {
   }
 }
 
-// 更新SPO2数据
+/*
+-更新SPO2数据 
+-原相接口更新,需要获取最大的血氧值,然后作为当前血氧值
+-最大为100,需要减1
+*/
+
 void BloodOxygenModel::UpSPO2data(uint8_t spo2) {
-  displayspo2 = spo2;
 
   // 处理有效与无效计数
-  if (displayspo2 != 0) {
-    currentspo2 = displayspo2; // 更新 currentspo2
+  if (spo2 != 0) {
+    if(spo2 > displayspo2)
+    {
+      displayspo2 = spo2;
+    }
     valid_counter_++;          // 增加有效计数器
     disvalid_counter_ = 0;     // 清空无效计数器
   } else {
@@ -252,9 +259,12 @@ void BloodOxygenModel::UpSPO2data(uint8_t spo2) {
 
   // 检查有效计数器是否达标
   if (valid_counter_ >= MAX_VALID_SPO2_COUNT) {
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
-                  "检测结果: 成功 valid_counter: %d currentspo2: %d",
-                  valid_counter_, currentspo2);
+    if(displayspo2 == 100)
+    {
+      displayspo2 == 99;
+    }
+    currentspo2 = displayspo2;
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,  "检测结果: 成功 valid_counter: %d currentspo2: %d",  valid_counter_, currentspo2);
     SetResult(BloodResult::SUCCESS); // 成功检测
     Blood_Stop();
   }