Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions StatusWidget/StatusWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ class StatusWidgetProvider: TimelineProvider {

var delta: HKQuantity?

// Making sure that previous glucose is within 5 mins of last glucose to avoid large deltas on sensor changes, missed readings, etc.
// Making sure that previous glucose is within 6 mins of last glucose to avoid large deltas on sensor changes, missed readings, etc.
if let prevGlucose = previousGlucose,
let currGlucose = currentGlucose,
abs((prevGlucose.startDate.addingTimeInterval(.minutes(5)) - currGlucose.startDate).minutes) > 1
currGlucose.startDate.timeIntervalSince(prevGlucose.startDate).minutes < 6
{
let deltaMGDL = currGlucose.quantity.doubleValue(for: .milligramsPerDeciliter) - prevGlucose.quantity.doubleValue(for: .milligramsPerDeciliter)
delta = HKQuantity(unit: .milligramsPerDeciliter, doubleValue: deltaMGDL)
Expand Down