Browse Source

Remove min glucose count limitation

Ivan Valkou 4 years ago
parent
commit
a2c1f65cd1

+ 1 - 1
FreeAPS/Resources/javascript/prepare/meal.js

@@ -25,7 +25,7 @@ function generate(pumphistory_data, profile_data, clock_data, glucose_data, basa
 
     var recentCarbs = freeaps_meal(inputs);
 
-    if (glucose_data.length < 36) {
+    if (glucose_data.length < 4) {
         console.error("Not enough glucose data to calculate carb absorption; found:", glucose_data.length);
         recentCarbs.mealCOB = 0;
         recentCarbs.reason = "not enough glucose data to calculate carb absorption";

+ 1 - 1
FreeAPS/Sources/APS/APSManager.swift

@@ -211,7 +211,7 @@ final class BaseAPSManager: APSManager, Injectable {
 
     func determineBasal() -> AnyPublisher<Bool, Never> {
         debug(.apsManager, "Start determine basal")
-        guard let glucose = storage.retrieve(OpenAPS.Monitor.glucose, as: [BloodGlucose].self), glucose.count >= 36 else {
+        guard let glucose = storage.retrieve(OpenAPS.Monitor.glucose, as: [BloodGlucose].self), glucose.isNotEmpty else {
             debug(.apsManager, "Not enough glucose data")
             processError(APSError.glucoseError(message: "Not enough glucose data"))
             return Just(false).eraseToAnyPublisher()