Skip to content

Commit f164ecf

Browse files
committed
Basal lock, locked at 200 mg/dl
1 parent f6d3a83 commit f164ecf

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

basal_lock/basal_lock.patch

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Submodule LoopKit contains modified content
2+
diff --git a/LoopKit/LoopKit/LoopAlgorithm/DoseMath.swift b/LoopKit/LoopKit/LoopAlgorithm/DoseMath.swift
3+
index f4b8d44a..bf5083ee 100644
4+
--- a/LoopKit/LoopKit/LoopAlgorithm/DoseMath.swift
5+
+++ b/LoopKit/LoopKit/LoopAlgorithm/DoseMath.swift
6+
@@ -427,13 +427,22 @@ extension Collection where Element: GlucoseValue {
7+
maxBasalRate = Swift.min(maxThirtyMinuteRateToKeepIOBBelowLimit, maxBasalRate)
8+
}
9+
10+
- let temp = correction?.asTempBasal(
11+
+ var temp = correction?.asTempBasal(
12+
scheduledBasalRate: scheduledBasalRate,
13+
maxBasalRate: maxBasalRate,
14+
duration: duration,
15+
rateRounder: rateRounder
16+
)
17+
18+
+ if (( temp?.unitsPerHour ?? scheduledBasalRate < scheduledBasalRate ||
19+
+ lastTempBasal?.unitsPerHour ?? scheduledBasalRate < scheduledBasalRate
20+
+ ) &&
21+
+ self[0 as! Self.Index].quantity > HKQuantity(unit : HKUnit.milligramsPerDeciliter, doubleValue: 200))
22+
+ {
23+
+ print("####### Temp Basal Lock On #########")
24+
+ temp = TempBasalRecommendation(unitsPerHour: scheduledBasalRate, duration: 1800)
25+
+ }
26+
+
27+
return temp?.ifNecessary(
28+
at: date,
29+
scheduledBasalRate: scheduledBasalRate,
30+
@@ -517,6 +526,15 @@ extension Collection where Element: GlucoseValue {
31+
volumeRounder: volumeRounder
32+
)
33+
34+
+ if ( (temp?.unitsPerHour ?? scheduledBasalRate < scheduledBasalRate ||
35+
+ lastTempBasal?.unitsPerHour ?? scheduledBasalRate < scheduledBasalRate
36+
+ ) &&
37+
+ self[0 as! Self.Index].quantity > HKQuantity(unit : HKUnit.milligramsPerDeciliter, doubleValue: 200))
38+
+ {
39+
+ print("####### Temp Basal Lock On #########")
40+
+ temp = TempBasalRecommendation(unitsPerHour: scheduledBasalRate, duration: 1800)
41+
+ }
42+
+
43+
if temp != nil || bolusUnits > 0 {
44+
return AutomaticDoseRecommendation(basalAdjustment: temp, bolusUnits: bolusUnits)
45+
}

0 commit comments

Comments
 (0)