Skip to content
Merged
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
11 changes: 5 additions & 6 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

github "LoopKit/LoopKit" "dev"
github "LoopKit/CGMBLEKit" "dev"
github "rsilvers129/LoopKit" "FPU-dev"
github "rsilvers129/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/dexcom-share-client-swift" "carthage-recursive"
github "rsilvers129/G4ShareSpy" "fix-cartfile"
github "rsilvers129/rileylink_ios" "FPU-dev"
github "LoopKit/Amplitude-iOS" "decreepify"
10 changes: 5 additions & 5 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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" "0e7ec1ef2845a88d43dd54187e23f258c97d9cc2"
github "rsilvers129/dexcom-share-client-swift" "20d6724bc9548aa350b032d895b7ff45eaa0274a"
github "rsilvers129/rileylink_ios" "5c47e983f46ea39ffbec52898963f609523b5fb4"
13 changes: 13 additions & 0 deletions 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,6 +123,8 @@ extension UserDefaults {
maximumBasalRatePerHour: maximumBasalRatePerHour,
maximumBolus: maximumBolus,
suspendThreshold: suspendThreshold,
fpuRatio: fpuRatio,
fpuDelay: fpuDelay,
retrospectiveCorrectionEnabled: bool(forKey: "com.loudnate.Loop.RetrospectiveCorrectionEnabled")
)
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
}
}
11 changes: 11 additions & 0 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,6 +21,10 @@ struct LoopSettings: Equatable {
var maximumBolus: Double?

var suspendThreshold: GlucoseThreshold? = nil

var fpuRatio: Double?

var fpuDelay: Double?

var retrospectiveCorrectionEnabled = true

Expand Down Expand Up @@ -63,6 +68,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 @@ -84,6 +93,8 @@ extension LoopSettings: RawRepresentable {
raw["maximumBasalRatePerHour"] = maximumBasalRatePerHour
raw["maximumBolus"] = maximumBolus
raw["minimumBGGuard"] = suspendThreshold?.rawValue
raw["fpuRatio"] = fpuRatio
raw["fpuDelay"] = fpuDelay

return raw
}
Expand Down
2 changes: 1 addition & 1 deletion DoseMathTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.9.2</string>
<string>1.9.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
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.2</string>
<string>1.9.3-FPU-dev-1.0</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
Loading