فهرست منبع

Fixing rounding and using the correct value for eventualGlucose

This commit fixes a rounding issue with eventualGlucose (rounds before
converting to an Int) and makes sure that we're using the right
`eventualGlucose` value for our enableSmb function.
Sam King 9 ماه پیش
والد
کامیت
2a68c5d968
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      Trio/Sources/APS/OpenAPSSwift/DetermineBasal/DetermineBasalGenerator.swift

+ 2 - 2
Trio/Sources/APS/OpenAPSSwift/DetermineBasal/DetermineBasalGenerator.swift

@@ -291,7 +291,7 @@ enum DeterminationGenerator {
             adjustedTargetGlucose: adjustedGlucoseTargets.targetGlucose,
             adjustedTargetGlucose: adjustedGlucoseTargets.targetGlucose,
             adjustedSensitivity: adjustedSensitivity,
             adjustedSensitivity: adjustedSensitivity,
             minGuardGlucose: forecastResult.minGuardGlucose,
             minGuardGlucose: forecastResult.minGuardGlucose,
-            eventualGlucose: eventualGlucose,
+            eventualGlucose: forecastResult.eventualGlucose,
             threshold: threshold,
             threshold: threshold,
             glucoseStatus: glucoseStatus,
             glucoseStatus: glucoseStatus,
             trioCustomOrefVariables: trioCustomOrefVariables,
             trioCustomOrefVariables: trioCustomOrefVariables,
@@ -305,7 +305,7 @@ enum DeterminationGenerator {
             reason: dosingInputs.reason,
             reason: dosingInputs.reason,
             units: nil,
             units: nil,
             insulinReq: nil,
             insulinReq: nil,
-            eventualBG: Int(forecastResult.eventualGlucose),
+            eventualBG: Int(forecastResult.eventualGlucose.jsRounded()),
             sensitivityRatio: sensitivityRatio, // this would only the AS-adjusted one for now
             sensitivityRatio: sensitivityRatio, // this would only the AS-adjusted one for now
             rate: nil,
             rate: nil,
             duration: nil,
             duration: nil,