Skip to content

Commit 350e401

Browse files
authored
Consider values < 40mg/dL as unreliable (#732)
1 parent 9bb5787 commit 350e401

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

Loop/Managers/CGM/DexCGMManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ final class ShareClientManager: CGMManager {
9393

9494
// Ignore glucose values that are up to a minute newer than our previous value, to account for possible time shifting in Share data
9595
let startDate = self.delegate?.startDateToFilterNewData(for: self)?.addingTimeInterval(TimeInterval(minutes: 1))
96-
let newGlucose = glucose.filterDateRange(startDate, nil).map {
96+
let newGlucose = glucose.filterDateRange(startDate, nil).filter({ $0.isStateValid }).map {
9797
return (quantity: $0.quantity, date: $0.startDate, isDisplayOnly: false)
9898
}
9999

Loop/Managers/LoopDataManager.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -890,8 +890,6 @@ final class LoopDataManager {
890890
throw LoopError.configurationError("Check settings")
891891
}
892892

893-
let pendingInsulin = try self.getPendingInsulin()
894-
895893
guard lastRequestedBolus == nil
896894
else {
897895
// Don't recommend changes if a bolus was just requested.
@@ -903,20 +901,22 @@ final class LoopDataManager {
903901
}
904902

905903
let tempBasal = predictedGlucose.recommendedTempBasal(
906-
to: glucoseTargetRange,
907-
suspendThreshold: settings.suspendThreshold?.quantity,
908-
sensitivity: insulinSensitivity,
909-
model: model,
910-
basalRates: basalRates,
911-
maxBasalRate: maxBasal,
912-
lastTempBasal: lastTempBasal
913-
)
904+
to: glucoseTargetRange,
905+
suspendThreshold: settings.suspendThreshold?.quantity,
906+
sensitivity: insulinSensitivity,
907+
model: model,
908+
basalRates: basalRates,
909+
maxBasalRate: maxBasal,
910+
lastTempBasal: lastTempBasal
911+
)
914912

915913
if let temp = tempBasal {
916914
recommendedTempBasal = (recommendation: temp, date: startDate)
917915
} else {
918916
recommendedTempBasal = nil
919917
}
918+
919+
let pendingInsulin = try self.getPendingInsulin()
920920

921921
let recommendation = predictedGlucose.recommendedBolus(
922922
to: glucoseTargetRange,

Loop/Models/ServiceAuthentication/AmplitudeService.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class AmplitudeService: ServiceAuthentication {
4646

4747
isAuthorized = true
4848
let client = Amplitude()
49+
client.disableIdfaTracking()
4950
client.disableLocationListening()
5051
client.initializeApiKey(APIKey)
5152
self.client = client

Loop/Models/ShareGlucose+GlucoseKit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extension ShareGlucose: GlucoseValue {
2626

2727
extension ShareGlucose: SensorDisplayable {
2828
public var isStateValid: Bool {
29-
return glucose >= 20
29+
return glucose >= 39
3030
}
3131

3232
public var trendType: GlucoseTrend? {

0 commit comments

Comments
 (0)