Skip to content
Closed
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[submodule "Carthage/Checkouts/Amplitude-iOS"]
path = Carthage/Checkouts/Amplitude-iOS
url = https://github.com/LoopKit/Amplitude-iOS.git
[submodule "Carthage/Checkouts/dexcom-share-client-swift"]
path = Carthage/Checkouts/dexcom-share-client-swift
url = https://github.com/rsilvers129/dexcom-share-client-swift.git
[submodule "Carthage/Checkouts/SwiftCharts"]
path = Carthage/Checkouts/SwiftCharts
url = https://github.com/i-schuetz/SwiftCharts.git
[submodule "Carthage/Checkouts/G4ShareSpy"]
path = Carthage/Checkouts/G4ShareSpy
url = https://github.com/rsilvers129/G4ShareSpy.git
[submodule "Carthage/Checkouts/CGMBLEKit"]
path = Carthage/Checkouts/CGMBLEKit
url = https://github.com/rsilvers129/CGMBLEKit.git
[submodule "Carthage/Checkouts/rileylink_ios"]
path = Carthage/Checkouts/rileylink_ios
url = https://github.com/rsilvers129/rileylink_ios.git
[submodule "Carthage/Checkouts/LoopKit"]
path = Carthage/Checkouts/LoopKit
url = https://github.com/rsilvers129/LoopKit.git
[submodule "Carthage/Checkouts/spike-client-swift-master"]
path = Carthage/Checkouts/spike-client-swift-master
url = https://github.com/rsilvers129/spike-client-swift-master.git
14 changes: 7 additions & 7 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

github "LoopKit/LoopKit" "dev"
github "LoopKit/CGMBLEKit" "dev"
github "i-schuetz/SwiftCharts" == 0.6.2
github "LoopKit/dexcom-share-client-swift" "carthage-recursive"
github "LoopKit/G4ShareSpy" "fix-cartfile"
github "ps2/rileylink_ios" "dev"
github "rsilvers129/LoopKit" "FPU-dev"
github "rsilvers129/CGMBLEKit" "dev"
github "ps2/SwiftCharts" "hotfix-xcode10.2"
github "rsilvers129/dexcom-share-client-swift" "carthage-recursive"
github "rsilvers129/G4ShareSpy" "fix-cartfile"
github "rsilvers129/rileylink_ios" "FPU-dev"
github "LoopKit/Amplitude-iOS" "decreepify"
github "rsilvers129/spike-client-swift-master" "FPU-dev"
11 changes: 6 additions & 5 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
github "LoopKit/Amplitude-iOS" "2137d5fd44bf630ed33e1e72d7af6d8f8612f270"
github "LoopKit/CGMBLEKit" "bc7c6bb2aaea48e501ecdbb379cd3a533f5df42e"
github "LoopKit/G4ShareSpy" "67208c66abfbb3bff813f047b6c40612338a335b"
github "LoopKit/LoopKit" "1c23bb5fd54c0b0aaa81dbabcb35f2d4c9c2e8cf"
github "LoopKit/dexcom-share-client-swift" "27fd38c28dcb16093ddf660c2b6b84ae34733352"
github "i-schuetz/SwiftCharts" "0.6.2"
github "ps2/rileylink_ios" "5df08f32f11ac2cb6097ba1411349f05b9171e72"
github "rsilvers129/CGMBLEKit" "8eb7b463490b76e93143dafec2b24951e4305a41"
github "rsilvers129/G4ShareSpy" "0448cfc3de9637c3b89698c3e5645d472aefb1e8"
github "rsilvers129/LoopKit" "2e143a2f2bba1b5aae3a542504aa78ccc032150c"
github "rsilvers129/dexcom-share-client-swift" "10d5739613f8b70946210f763a260e80a17cb1a8"
github "rsilvers129/rileylink_ios" "5c47e983f46ea39ffbec52898963f609523b5fb4"
github "rsilvers129/spike-client-swift-master" "45bda83426eb52a5ca9ff746e95988ec04006f85"
1 change: 1 addition & 0 deletions Carthage/Checkouts/Amplitude-iOS
Submodule Amplitude-iOS added at 2137d5
1 change: 1 addition & 0 deletions Carthage/Checkouts/CGMBLEKit
Submodule CGMBLEKit added at 8eb7b4
1 change: 1 addition & 0 deletions Carthage/Checkouts/G4ShareSpy
Submodule G4ShareSpy added at 0448cf
1 change: 1 addition & 0 deletions Carthage/Checkouts/LoopKit
Submodule LoopKit added at 2e143a
1 change: 1 addition & 0 deletions Carthage/Checkouts/SwiftCharts
Submodule SwiftCharts added at c16ddb
1 change: 1 addition & 0 deletions Carthage/Checkouts/dexcom-share-client-swift
1 change: 1 addition & 0 deletions Carthage/Checkouts/rileylink_ios
Submodule rileylink_ios added at 5c47e9
1 change: 1 addition & 0 deletions Carthage/Checkouts/spike-client-swift-master
4 changes: 4 additions & 0 deletions Common/Extensions/GlucoseRangeSchedule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ extension GlucoseRangeSchedule {
func minQuantity(at date: Date) -> HKQuantity {
return HKQuantity(unit: unit, doubleValue: value(at: date).minValue)
}

func maxQuantity(at date: Date) -> HKQuantity {
return HKQuantity(unit: unit, doubleValue: value(at: date).maxValue)
}
}


Expand Down
16 changes: 15 additions & 1 deletion Common/Extensions/NSUserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//
// Created by Nathan Racklyeft on 8/30/15.
// Copyright © 2015 Nathan Racklyeft. All rights reserved.
// Fat-Protein Unit code by Robert Silvers, 10/2018.
//

import Foundation
Expand Down Expand Up @@ -100,6 +101,16 @@ extension UserDefaults {
if maximumBasalRatePerHour! <= 0 {
maximumBasalRatePerHour = nil
}

var fpuRatio: Double? = double(forKey: "com.loudnate.Naterade.FPURatio")
if fpuRatio! <= 0 {
fpuRatio = nil
}

var fpuDelay: Double? = double(forKey: "com.loudnate.Naterade.FPUDelay")
if fpuDelay! <= 0 {
fpuDelay = nil
}

var maximumBolus: Double? = double(forKey: "com.loudnate.Naterade.MaximumBolus")
if maximumBolus! <= 0 {
Expand All @@ -112,7 +123,10 @@ extension UserDefaults {
maximumBasalRatePerHour: maximumBasalRatePerHour,
maximumBolus: maximumBolus,
suspendThreshold: suspendThreshold,
retrospectiveCorrectionEnabled: bool(forKey: "com.loudnate.Loop.RetrospectiveCorrectionEnabled")
fpuRatio: fpuRatio,
fpuDelay: fpuDelay,
retrospectiveCorrectionEnabled: bool(forKey: "com.loudnate.Loop.RetrospectiveCorrectionEnabled"),
integralRetrospectiveCorrectionEnabled: bool(forKey: "com.loopkit.Loop.IntegralRetrospectiveCorrectionEnabled")
)
self.loopSettings = settings

Expand Down
39 changes: 39 additions & 0 deletions Common/Models/FPUDelay.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// FPUDelay.swift
// Loop
//
// Created by Robert Silvers on 10/19/18.
// Copyright © 2018 LoopKit Authors. All rights reserved.
//

import Foundation
import HealthKit

struct FPUDelay: RawRepresentable {
typealias RawValue = [String: Any]

let value: Double

public init(value: Double) {
self.value = value
}

init?(rawValue: RawValue) {
guard let value = rawValue["value"] as? Double else {
return nil
}
self.value = value
}

var rawValue: RawValue {
return [
"value": value,
]
}
}

extension FPUDelay: Equatable {
static func ==(lhs: FPUDelay, rhs: FPUDelay) -> Bool {
return lhs.value == rhs.value
}
}
39 changes: 39 additions & 0 deletions Common/Models/FPURatio.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// FPURatio.swift
// Loop
//
// Created by Robert Silvers on 10/19/18.
// Copyright © 2018 LoopKit Authors. All rights reserved.
//

import Foundation
import HealthKit

struct FPURatio: RawRepresentable {
typealias RawValue = [String: Any]

let value: Double

public init(value: Double) {
self.value = value
}

init?(rawValue: RawValue) {
guard let value = rawValue["value"] as? Double else {
return nil
}
self.value = value
}

var rawValue: RawValue {
return [
"value": value,
]
}
}

extension FPURatio: Equatable {
static func ==(lhs: FPURatio, rhs: FPURatio) -> Bool {
return lhs.value == rhs.value
}
}
22 changes: 20 additions & 2 deletions Common/Models/LoopSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//
// Copyright © 2017 LoopKit Authors. All rights reserved.
//
// Fat-Protein Unit code by Robert Silvers, 10/2018.

import LoopKit

Expand All @@ -20,14 +21,20 @@ struct LoopSettings: Equatable {
var maximumBolus: Double?

var suspendThreshold: GlucoseThreshold? = nil

var fpuRatio: Double?

var fpuDelay: Double?

var retrospectiveCorrectionEnabled = true

var integralRetrospectiveCorrectionEnabled = true

/// The interval over which to aggregate changes in glucose for retrospective correction
let retrospectiveCorrectionGroupingInterval = TimeInterval(minutes: 30)

/// The maximum duration over which to integrate retrospective correction changes
let retrospectiveCorrectionIntegrationInterval = TimeInterval(minutes: 30)
let retrospectiveCorrectionIntegrationInterval = TimeInterval(minutes: 180)

/// The amount of time since a given date that data should be considered valid
let recencyInterval = TimeInterval(minutes: 15)
Expand Down Expand Up @@ -63,6 +70,10 @@ extension LoopSettings: RawRepresentable {
self.maximumBasalRatePerHour = rawValue["maximumBasalRatePerHour"] as? Double

self.maximumBolus = rawValue["maximumBolus"] as? Double

self.fpuRatio = rawValue["fpuRatio"] as? Double

self.fpuDelay = rawValue["fpuDelay"] as? Double

if let rawThreshold = rawValue["minimumBGGuard"] as? GlucoseThreshold.RawValue {
self.suspendThreshold = GlucoseThreshold(rawValue: rawThreshold)
Expand All @@ -71,19 +82,26 @@ extension LoopSettings: RawRepresentable {
if let retrospectiveCorrectionEnabled = rawValue["retrospectiveCorrectionEnabled"] as? Bool {
self.retrospectiveCorrectionEnabled = retrospectiveCorrectionEnabled
}

if let integralRetrospectiveCorrectionEnabled = rawValue["integralRetrospectiveCorrectionEnabled"] as? Bool {
self.integralRetrospectiveCorrectionEnabled = integralRetrospectiveCorrectionEnabled
}
}

var rawValue: RawValue {
var raw: RawValue = [
"version": LoopSettings.version,
"dosingEnabled": dosingEnabled,
"retrospectiveCorrectionEnabled": retrospectiveCorrectionEnabled
"retrospectiveCorrectionEnabled": retrospectiveCorrectionEnabled,
"integralRetrospectiveCorrectionEnabled": integralRetrospectiveCorrectionEnabled
]

raw["glucoseTargetRangeSchedule"] = glucoseTargetRangeSchedule?.rawValue
raw["maximumBasalRatePerHour"] = maximumBasalRatePerHour
raw["maximumBolus"] = maximumBolus
raw["minimumBGGuard"] = suspendThreshold?.rawValue
raw["fpuRatio"] = fpuRatio
raw["fpuDelay"] = fpuDelay

return raw
}
Expand Down
Binary file added FPU-calc.xlsx
Binary file not shown.
10 changes: 5 additions & 5 deletions Loop Status Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppGroupIdentifier</key>
<string>$(APP_GROUP_IDENTIFIER)</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>MainAppBundleIdentifier</key>
<string>$(MAIN_APP_BUNDLE_IDENTIFIER)</string>
<key>CFBundleDisplayName</key>
<string>Loop</string>
<key>CFBundleExecutable</key>
Expand All @@ -19,11 +19,11 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.9.4 dev</string>
<string>1.9.4-FPU-IRC-1.7</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>AppGroupIdentifier</key>
<string>$(APP_GROUP_IDENTIFIER)</string>
<key>MainAppBundleIdentifier</key>
<string>$(MAIN_APP_BUNDLE_IDENTIFIER)</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Loop-IRC.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Loading