Просмотр исходного кода

Add 500 mg/dL to condition to cater for U.S./CA Libres

Deniz Cengiz 11 месяцев назад
Родитель
Сommit
f8b8366349
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      Model/Helper/GlucoseStored+helper.swift

+ 4 - 1
Model/Helper/GlucoseStored+helper.swift

@@ -33,7 +33,10 @@ extension GlucoseStored {
 
         let firstValue = glucose.first?.glucose
 
-        return glucose.allSatisfy { $0.glucose == firstValue && $0.glucose == 400 }
+        /// 400 mg/dL covers all Dexcom CGMs as well as European Libre 2 and most readings from xDrip4iOS.
+        /// U.S. / Canadian Libres can emit up to 500 mg/dL until it reads "HI"
+        /// Our condition considers both these values, 400 and 500, as possible "flat" readings when paired CGM reads HIGH.
+        return glucose.allSatisfy { $0.glucose == firstValue && ($0.glucose == 400 || $0.glucose == 500) }
     }
 
     // Preview