Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d951c37
Fix basal rate editor saving the lowest rate on 0.01 U/h pumps
Lamercho Oct 26, 2026
9b60e4e
Merge branch 'dev' into fix/basal-rate-editor-rounding
Lamercho Oct 29, 2026
76181fd
Merge branch 'dev' into fix/basal-rate-editor-rounding
Lamercho Oct 30, 2026
7c48cab
Merge branch 'dev' into fix/basal-rate-editor-rounding
Lamercho Oct 31, 2026
d5492db
Merge branch 'dev' into fix/basal-rate-editor-rounding
Lamercho Nov 1, 2026
9b742e3
Merge branch 'dev' into fix/basal-rate-editor-rounding
Lamercho Nov 2, 2026
5352a14
Format percentages with the locale's percent style
lolzivkovic Oct 31, 2026
83e890d
Fix Tidepool dose uploads failing with "configuration"
loudestnoise Nov 3, 2026
3bb3c60
Use one formatter for durations and time ago
lolzivkovic Nov 5, 2026
d785ea9
Trim Tidepool delegate comments
loudestnoise Nov 6, 2026
169637a
Merge pull request #1742 from loudestnoise/fix/tidepool-remote-data-d…
dnzxy Nov 7, 2026
7040d5a
CI: Bump APP_DEV_VERSION to 1.0.2.60 [skip ci]
github-actions[bot] Nov 7, 2026
11a4239
Merge pull request #1674 from Lamercho/fix/basal-rate-editor-rounding
dnzxy Nov 8, 2026
e7ded6f
CI: Bump APP_DEV_VERSION to 1.0.2.61 [skip ci]
github-actions[bot] Nov 8, 2026
66494b6
Fix sensitivity ratio decimals and rename translation keys
lolzivkovic Nov 8, 2026
f3a266e
Read time ago as the visible span and keep minutes in stored durations
lolzivkovic Nov 9, 2026
de46cd9
Fix SMB/UAM minute labels and update duration tests
lolzivkovic Nov 9, 2026
569a1e5
Translate SMBs Off in the Adjustments override row
lolzivkovic Nov 9, 2026
a349f86
Redact signed-out Dexcom Share accounts in export
dnzxy Nov 9, 2026
ab0a7a1
Fix Medtrum crash loop and device delete races
dnzxy Nov 9, 2026
96e72d7
Merge pull request #1727 from lolzivkovic/fix/percentage-formatting
dnzxy Nov 9, 2026
ed57a06
CI: Bump APP_DEV_VERSION to 1.0.2.62 [skip ci]
github-actions[bot] Nov 9, 2026
c6ff7e0
Wait for first unlock when Core Data load is denied
dnzxy Nov 10, 2026
efb6478
Merge pull request #1756 from dnzxy/fix/share-username-redaction
AndreasStokholm Nov 10, 2026
61f91b5
CI: Bump APP_DEV_VERSION to 1.0.2.63 [skip ci]
github-actions[bot] Nov 10, 2026
fd57507
Merge pull request #1757 from dnzxy/fix/medtrum-alert-queue
AndreasStokholm Nov 10, 2026
9ccaad1
CI: Bump APP_DEV_VERSION to 1.0.2.64 [skip ci]
github-actions[bot] Nov 10, 2026
5596e5d
Merge branch 'dev' into fix/duration-formatting
lolzivkovic Nov 10, 2026
97537ae
Merge pull request #1743 from lolzivkovic/fix/duration-formatting
dnzxy Nov 10, 2026
8437e8a
CI: Bump APP_DEV_VERSION to 1.0.2.65 [skip ci]
github-actions[bot] Nov 10, 2026
1f42b35
Merge pull request #1672 from dnzxy/fix/coredata-first-unlock
kingst Nov 10, 2026
902be75
CI: Bump APP_DEV_VERSION to 1.0.2.66 [skip ci]
github-actions[bot] Nov 10, 2026
742f7a8
sync(trio): merge upstream/dev at 902be75e8
mountrcg Nov 11, 2026
1b77bc0
fix(basal): resolve picker basal rates against the pump's rate table
mountrcg Nov 11, 2026
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
2 changes: 1 addition & 1 deletion Config.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TRIO_APP_GROUP_ID = group.org.nightscout.$(DEVELOPMENT_TEAM).trio.trio-app-group

// The developers set the version numbers, please leave them alone
APP_VERSION = 1.0.2
APP_DEV_VERSION = 1.0.2.59
APP_DEV_VERSION = 1.0.2.66
APP_BUILD_NUMBER = 1
COPYRIGHT_NOTICE = autoISF 3.01

Expand Down
2 changes: 1 addition & 1 deletion LibreLoop
2 changes: 1 addition & 1 deletion MedtrumKit
66 changes: 64 additions & 2 deletions Model/CoreDataStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Combine
import CoreData
import Foundation
import OSLog
import UIKit

class CoreDataStack: ObservableObject {
static let shared = CoreDataStack()
Expand Down Expand Up @@ -294,8 +295,12 @@ class CoreDataStack: ObservableObject {
if retryCount < maxRetries {
debug(.storage, "Retrying Core Data initialization (\(retryCount + 1)/\(maxRetries))")

// Wait before retrying
try await Task.sleep(for: .seconds(1))
// Before the first unlock after a restart the store is unreadable, so wait for the unlock
if Self.isProtectedDataUnavailableError(initError) {
await Self.waitForProtectedData()
} else {
try await Task.sleep(for: .seconds(1))
}

// Retry the initialization
try await initializeStack(retryCount: retryCount + 1)
Expand All @@ -308,6 +313,63 @@ class CoreDataStack: ObservableObject {
}
}

// MARK: - Protected Data

extension CoreDataStack {
/// After a restart, iOS can launch Trio in the background before the first unlock, when the store file
/// is unreadable and SQLite reports SQLITE_AUTH (23). `isProtectedDataAvailable` alone can't tell this
/// apart from an ordinary lock, during which the store stays readable.
static func isProtectedDataUnavailableError(_ error: Error) -> Bool {
let nsError = error as NSError
if (nsError.userInfo[NSSQLiteErrorDomain] as? Int) == 23 {
return true
}
if let underlying = nsError.userInfo[NSUnderlyingErrorKey] as? Error {
return isProtectedDataUnavailableError(underlying)
}
return false
}

/// Waits until protected data is available, i.e. the device has been unlocked.
@MainActor static func waitForProtectedData(
isAvailable: @MainActor() -> Bool = { UIApplication.shared.isProtectedDataAvailable },
notificationCenter: Foundation.NotificationCenter = .default
) async {
guard !isAvailable() else { return }
info(.storage, "Waiting for the first unlock before opening the Core Data store")

final class Waiter {
var observer: NSObjectProtocol?
var continuation: CheckedContinuation<Void, Never>?
}
let waiter = Waiter()

await withCheckedContinuation { continuation in
waiter.continuation = continuation
let finish = {
guard let continuation = waiter.continuation else { return }
waiter.continuation = nil
if let observer = waiter.observer {
notificationCenter.removeObserver(observer)
}
continuation.resume()
}
waiter.observer = notificationCenter.addObserver(
forName: UIApplication.protectedDataDidBecomeAvailableNotification,
object: nil,
queue: .main
) { _ in
MainActor.assumeIsolated { finish() }
}
// An unlock between the first check and adding the observer would otherwise be missed
if isAvailable() {
finish()
}
}
info(.storage, "Device unlocked, opening the Core Data store")
}
}

// MARK: - Delete

extension CoreDataStack {
Expand Down
2 changes: 1 addition & 1 deletion SyaiKit
20 changes: 12 additions & 8 deletions Trio.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@
BD11A011000000000000A011 /* RoundBasalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD11A010000000000000A011 /* RoundBasalTests.swift */; };
BD11A013000000000000A011 /* BasalRoundingDriverParityTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD11A012000000000000A011 /* BasalRoundingDriverParityTests.swift */; };
BD11A015000000000000A011 /* PumpRateTables.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD11A014000000000000A011 /* PumpRateTables.swift */; };
BD11C001000000000000C001 /* CGMSensorDisplayState.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD11C000000000000000C001 /* CGMSensorDisplayState.swift */; };
BD11C001000000000000C003 /* SensorLifecycleArcView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD11C000000000000000C003 /* SensorLifecycleArcView.swift */; };
BD11C001000000000000C004 /* SensorStatusTagView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD11C000000000000000C004 /* SensorStatusTagView.swift */; };
BD136FAE2F6AC55F002217F9 /* NSFetchedResultsControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD136FAD2F6AC555002217F9 /* NSFetchedResultsControllerDelegate.swift */; };
Expand Down Expand Up @@ -724,6 +723,8 @@
BD54A95C2D2808A300F9C1EE /* OverridePresetWatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD54A95A2D28087700F9C1EE /* OverridePresetWatch.swift */; };
BD54A9712D281A8100F9C1EE /* TempTargetPresetsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD54A9702D281A7A00F9C1EE /* TempTargetPresetsView.swift */; };
A1A0EDA830974FFF0028A032 /* GlucoseFormattingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1A0EDA730974FFF0028A032 /* GlucoseFormattingTests.swift */; };
A1EF5D9B309CEF01007282CC /* DurationFormattingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1EF5D9A309CEF01007282CC /* DurationFormattingTests.swift */; };
A1A0EDF53097CE470028A032 /* PercentFormattingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1A0EDF43097CE470028A032 /* PercentFormattingTests.swift */; };
A1B2C3D40F00000000000002 /* AlarmSnoozeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D40F00000000000001 /* AlarmSnoozeView.swift */; };
BD54A9732D281ABC00F9C1EE /* TempTargetPresetWatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD54A9722D281A9C00F9C1EE /* TempTargetPresetWatch.swift */; };
BD54A9742D281AEF00F9C1EE /* TempTargetPresetWatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD54A9722D281A9C00F9C1EE /* TempTargetPresetWatch.swift */; };
Expand Down Expand Up @@ -752,6 +753,7 @@
36BDB3927CB9ABFB548ED2B0 /* CarbEntryMutationServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A19B7FC1E8CD873546B563CB /* CarbEntryMutationServiceTests.swift */; };
BD8FC0622D6619E600B95AED /* OverrideStorageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD8FC0612D6619E600B95AED /* OverrideStorageTests.swift */; };
BD8FC0642D6619EF00B95AED /* TempTargetStorageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD8FC0632D6619EF00B95AED /* TempTargetStorageTests.swift */; };
FE9C3A9F2A75014FB09A16B1 /* CoreDataProtectedDataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D2BADBACD9C568C3682721A /* CoreDataProtectedDataTests.swift */; };
BD8FC0662D661A0000B95AED /* GlucoseStorageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD8FC0652D661A0000B95AED /* GlucoseStorageTests.swift */; };
BD8FC0712D661B0000B95AED /* TidepoolTherapySettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD8FC0702D661B0000B95AED /* TidepoolTherapySettingsTests.swift */; };
CD1235B000000000000000F2 /* TidepoolUploadSerializerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1235A000000000000000F1 /* TidepoolUploadSerializerTests.swift */; };
Expand Down Expand Up @@ -1070,7 +1072,6 @@
DDD1631A2C4C695E00CD525A /* EditOverrideForm.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD163192C4C695E00CD525A /* EditOverrideForm.swift */; };
DDD1631C2C4C697400CD525A /* AddOverrideForm.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD1631B2C4C697400CD525A /* AddOverrideForm.swift */; };
DDD1631F2C4C6F6900CD525A /* TrioCoreDataPersistentContainer.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = DDD1631D2C4C6F6900CD525A /* TrioCoreDataPersistentContainer.xcdatamodeld */; };
DDD5889D2DDDC9A900C8848D /* TimeAgoFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD5889C2DDDC9A900C8848D /* TimeAgoFormatter.swift */; };
DDD6D4D32CDE90720029439A /* EstimatedA1cDisplayUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD6D4D22CDE90720029439A /* EstimatedA1cDisplayUnit.swift */; };
DDD78A912DC4064800AC63F3 /* carbhistory.json in Resources */ = {isa = PBXBuildFile; fileRef = DDD78A902DC4064800AC63F3 /* carbhistory.json */; };
DDD78AD92DC421B500AC63F3 /* enacted.json in Resources */ = {isa = PBXBuildFile; fileRef = DDD78AD72DC421B500AC63F3 /* enacted.json */; };
Expand Down Expand Up @@ -1993,7 +1994,6 @@
BD11A010000000000000A011 /* RoundBasalTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundBasalTests.swift; sourceTree = "<group>"; };
BD11A012000000000000A011 /* BasalRoundingDriverParityTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasalRoundingDriverParityTests.swift; sourceTree = "<group>"; };
BD11A014000000000000A011 /* PumpRateTables.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PumpRateTables.swift; sourceTree = "<group>"; };
BD11C000000000000000C001 /* CGMSensorDisplayState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGMSensorDisplayState.swift; sourceTree = "<group>"; };
BD11C000000000000000C003 /* SensorLifecycleArcView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SensorLifecycleArcView.swift; sourceTree = "<group>"; };
BD11C000000000000000C004 /* SensorStatusTagView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SensorStatusTagView.swift; sourceTree = "<group>"; };
BD136FAD2F6AC555002217F9 /* NSFetchedResultsControllerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSFetchedResultsControllerDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2043,6 +2043,8 @@
BD54A95A2D28087700F9C1EE /* OverridePresetWatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverridePresetWatch.swift; sourceTree = "<group>"; };
BD54A9702D281A7A00F9C1EE /* TempTargetPresetsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TempTargetPresetsView.swift; sourceTree = "<group>"; };
A1A0EDA730974FFF0028A032 /* GlucoseFormattingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlucoseFormattingTests.swift; sourceTree = "<group>"; };
A1EF5D9A309CEF01007282CC /* DurationFormattingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DurationFormattingTests.swift; sourceTree = "<group>"; };
A1A0EDF43097CE470028A032 /* PercentFormattingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PercentFormattingTests.swift; sourceTree = "<group>"; };
A1B2C3D40F00000000000001 /* AlarmSnoozeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlarmSnoozeView.swift; sourceTree = "<group>"; };
BD54A9722D281A9C00F9C1EE /* TempTargetPresetWatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TempTargetPresetWatch.swift; sourceTree = "<group>"; };
BD6EB2D52C7D049B0086BBB6 /* LiveActivityWidgetConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveActivityWidgetConfiguration.swift; sourceTree = "<group>"; };
Expand All @@ -2068,6 +2070,7 @@
A19B7FC1E8CD873546B563CB /* CarbEntryMutationServiceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarbEntryMutationServiceTests.swift; sourceTree = "<group>"; };
BD8FC0612D6619E600B95AED /* OverrideStorageTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverrideStorageTests.swift; sourceTree = "<group>"; };
BD8FC0632D6619EF00B95AED /* TempTargetStorageTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TempTargetStorageTests.swift; sourceTree = "<group>"; };
2D2BADBACD9C568C3682721A /* CoreDataProtectedDataTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataProtectedDataTests.swift; sourceTree = "<group>"; };
BD8FC0652D661A0000B95AED /* GlucoseStorageTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlucoseStorageTests.swift; sourceTree = "<group>"; };
BD8FC0702D661B0000B95AED /* TidepoolTherapySettingsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TidepoolTherapySettingsTests.swift; sourceTree = "<group>"; };
CD1235A000000000000000F1 /* TidepoolUploadSerializerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TidepoolUploadSerializerTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2391,7 +2394,6 @@
DDD163192C4C695E00CD525A /* EditOverrideForm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditOverrideForm.swift; sourceTree = "<group>"; };
DDD1631B2C4C697400CD525A /* AddOverrideForm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddOverrideForm.swift; sourceTree = "<group>"; };
DDD1631E2C4C6F6900CD525A /* TrioCoreDataPersistentContainer.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = TrioCoreDataPersistentContainer.xcdatamodel; sourceTree = "<group>"; };
DDD5889C2DDDC9A900C8848D /* TimeAgoFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimeAgoFormatter.swift; sourceTree = "<group>"; };
DDD6D4D22CDE90720029439A /* EstimatedA1cDisplayUnit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EstimatedA1cDisplayUnit.swift; sourceTree = "<group>"; };
DDD78A902DC4064800AC63F3 /* carbhistory.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = carbhistory.json; sourceTree = "<group>"; };
DDD78AD72DC421B500AC63F3 /* enacted.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = enacted.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3585,7 +3587,6 @@
38E98A3625F5509500C0CED0 /* String+Extensions.swift */,
49239B422EEA27AD00469145 /* TempTargetCalculations.swift */,
DDCAE8322D78D49C00B1BB51 /* TherapySettingsUtil.swift */,
DDD5889C2DDDC9A900C8848D /* TimeAgoFormatter.swift */,
D7C5E1F4A7B91E2F3C5D6E71 /* TimeInterval+Convenience.swift */,
CEB434E428B8FF5D00B70274 /* UIColor.swift */,
FEFFA7A12929FE49007B8193 /* UIDevice+Extensions.swift */,
Expand Down Expand Up @@ -3734,6 +3735,8 @@
isa = PBXGroup;
children = (
A1A0EDA730974FFF0028A032 /* GlucoseFormattingTests.swift */,
A1EF5D9A309CEF01007282CC /* DurationFormattingTests.swift */,
A1A0EDF43097CE470028A032 /* PercentFormattingTests.swift */,
DDDD0FFD2F4E231600F9C645 /* Mocks */,
DDDD0FFA2F4E22C000F9C645 /* GlucoseSmoothingTests.swift */,
7A11AC0DE000000000000015 /* CoreDataTests/MultiUsePanelStateTests.swift */,
Expand Down Expand Up @@ -4520,7 +4523,6 @@
BD11C002000000000000C000 /* SensorLifecycle */ = {
isa = PBXGroup;
children = (
BD11C000000000000000C001 /* CGMSensorDisplayState.swift */,
BD11C000000000000000C003 /* SensorLifecycleArcView.swift */,
BD11C000000000000000C004 /* SensorStatusTagView.swift */,
);
Expand Down Expand Up @@ -4677,6 +4679,7 @@
A19B7FC1E8CD873546B563CB /* CarbEntryMutationServiceTests.swift */,
BD8FC0612D6619E600B95AED /* OverrideStorageTests.swift */,
BD8FC0632D6619EF00B95AED /* TempTargetStorageTests.swift */,
2D2BADBACD9C568C3682721A /* CoreDataProtectedDataTests.swift */,
BD8FC0652D661A0000B95AED /* GlucoseStorageTests.swift */,
);
path = CoreDataTests;
Expand Down Expand Up @@ -6328,7 +6331,6 @@
CEB434E328B8F9DB00B70274 /* BluetoothStateManager.swift in Sources */,
BDC2EA452C3043B000E5BBD0 /* OverrideStorage.swift in Sources */,
3811DE4225C9D4A100A708ED /* SettingsDataFlow.swift in Sources */,
DDD5889D2DDDC9A900C8848D /* TimeAgoFormatter.swift in Sources */,
D7C5E1F4A7B91E2F3C5D6E70 /* TimeInterval+Convenience.swift in Sources */,
CEE9A6562BBB418300EB5194 /* CalibrationsRootView.swift in Sources */,
3B5CD2B72D4AEA6600CE213C /* ComputedBGTargets.swift in Sources */,
Expand Down Expand Up @@ -6848,7 +6850,6 @@
BDF34F932C10D0E100D51995 /* LiveActivityAttributes+Helper.swift in Sources */,
E0D4F80527513ECF00BDF1FE /* HealthKitSample.swift in Sources */,
38AAF85525FFF846004AF583 /* CurrentGlucoseView.swift in Sources */,
BD11C001000000000000C001 /* CGMSensorDisplayState.swift in Sources */,
BD11C001000000000000C003 /* SensorLifecycleArcView.swift in Sources */,
BD11C001000000000000C004 /* SensorStatusTagView.swift in Sources */,
041D1E995A6AE92E9289DC49 /* TreatmentsDataFlow.swift in Sources */,
Expand Down Expand Up @@ -7061,6 +7062,8 @@
3B3B4F542E661A1200B668E3 /* DetermineBasalGlucoseFallingFasterThanExpectedTests.swift in Sources */,
3B5CD2CB2D4AECD500CE213C /* ProfileTargetsTests.swift in Sources */,
A1A0EDA830974FFF0028A032 /* GlucoseFormattingTests.swift in Sources */,
A1EF5D9B309CEF01007282CC /* DurationFormattingTests.swift in Sources */,
A1A0EDF53097CE470028A032 /* PercentFormattingTests.swift in Sources */,
3BAC92CD2E57859D00B853DA /* SetTempBasalTests.swift in Sources */,
BD11A011000000000000A011 /* RoundBasalTests.swift in Sources */,
BD11A015000000000000A011 /* PumpRateTables.swift in Sources */,
Expand All @@ -7076,6 +7079,7 @@
7A11AC0DE000000000000109 /* PumpEventFinalizationTests.swift in Sources */,
7A11AC0DE00000000000011D /* PumpEventPredicateTests.swift in Sources */,
BD8FC0642D6619EF00B95AED /* TempTargetStorageTests.swift in Sources */,
FE9C3A9F2A75014FB09A16B1 /* CoreDataProtectedDataTests.swift in Sources */,
3BE2F1E82E030E2F009E2900 /* MealCobTests.swift in Sources */,
3BBC22632DF5B94100169236 /* AutosensTests.swift in Sources */,
BD8FC0542D66186000B95AED /* TestError.swift in Sources */,
Expand Down
3 changes: 2 additions & 1 deletion Trio/Sources/APS/DeviceDataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ final class BaseDeviceDataManager: DeviceDataManager, Injectable {
}
let concentration = settingsManager.settings.insulinConcentration
if let pumpManager = pumpManager {
pumpManager.pumpManagerDelegate = self
// Queue before delegate, so no delegate call lands on the default main queue
pumpManager.delegateQueue = processQueue
pumpManager.pumpManagerDelegate = self

// Re-apply the latest CGM-aligned heartbeat request to a freshly set pump
if let heartbeatRequest = lastPumpHeartbeatRequest {
Expand Down
2 changes: 1 addition & 1 deletion Trio/Sources/APS/OpenAPS/OpenAPS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ final class OpenAPS {
halfBasalTarget: effectiveHBT,
target: targetValue,
autosensMax: preferences.autosensMax
))
).rounded())
debug(
.algorithm,
"Temp target \(targetValue) mg/dL: half basal target \(defaultHalfBasalTarget) -> \(effectiveHBT) mg/dL, \(percentage)%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ enum TempBasalFunctions {
return basalRate.rounded(scale: 5, roundingMode: .down)
}

return profile.supportedBasalRates.reduce(0) { nearest, rate in
let distance = abs(rate - basalRate)
let nearestDistance = abs(nearest - basalRate)
return distance < nearestDistance || (distance == nearestDistance && rate > nearest) ? rate : nearest
}
return basalRate.nearestSupportedBasalRate(in: profile.supportedBasalRates)
}

/// defines the max safe basal rate given a profile
Expand Down
Loading
Loading