Skip to content

Commit 71ce737

Browse files
committed
Include manual readings for algorithm glucose always nightscout#1054
1 parent c86d94f commit 71ce737

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Trio/Sources/APS/OpenAPS/OpenAPS.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,14 @@ final class OpenAPS {
132132

133133
return glucoseResults.map { glucose -> AlgorithmGlucose in
134134
let glucoseValue: Int16
135-
if shouldSmoothGlucose, !glucose.isManual, let smoothedGlucose = glucose.smoothedGlucose, smoothedGlucose != 0 {
136-
glucoseValue = smoothedGlucose.rounding(accordingToBehavior: roundingBehavior).int16Value
135+
if shouldSmoothGlucose {
136+
if !glucose.isManual, let smoothedGlucose = glucose.smoothedGlucose, smoothedGlucose != 0 {
137+
glucoseValue = smoothedGlucose.rounding(accordingToBehavior: roundingBehavior).int16Value
138+
} else {
139+
// use the raw value = finger prick, so manual readings are always included for algorithm decision making
140+
// cf. https://github.com/nightscout/Trio/issues/1054
141+
glucoseValue = glucose.glucose
142+
}
137143
} else {
138144
glucoseValue = glucose.glucose
139145
}

0 commit comments

Comments
 (0)