Sam King 1 год назад
Родитель
Сommit
f8873dc9cb

+ 0 - 4
FreeAPS.xcodeproj/project.pbxproj

@@ -244,7 +244,6 @@
 		3B5CD2A12D4AEA5100CE213C /* JavascriptOptional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B5CD29E2D4AEA5100CE213C /* JavascriptOptional.swift */; };
 		3B5CD2A22D4AEA5100CE213C /* JSONCompare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B5CD29F2D4AEA5100CE213C /* JSONCompare.swift */; };
 		3B5CD2A52D4AEA5D00CE213C /* Date+MinutesFromMidnight.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B5CD2A32D4AEA5D00CE213C /* Date+MinutesFromMidnight.swift */; };
-		3B5CD2B32D4AEA6600CE213C /* Autotune.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B5CD2A82D4AEA6600CE213C /* Autotune.swift */; };
 		3B5CD2B72D4AEA6600CE213C /* ComputedBGTargets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B5CD2A72D4AEA6600CE213C /* ComputedBGTargets.swift */; };
 		3B5CD2B82D4AEA6600CE213C /* ComputedInsulinSensitivities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B5CD2AD2D4AEA6600CE213C /* ComputedInsulinSensitivities.swift */; };
 		3B5CD2BE2D4AEA6600CE213C /* Profile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B5CD2AF2D4AEA6600CE213C /* Profile.swift */; };
@@ -970,7 +969,6 @@
 		3B5CD29F2D4AEA5100CE213C /* JSONCompare.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONCompare.swift; sourceTree = "<group>"; };
 		3B5CD2A32D4AEA5D00CE213C /* Date+MinutesFromMidnight.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+MinutesFromMidnight.swift"; sourceTree = "<group>"; };
 		3B5CD2A72D4AEA6600CE213C /* ComputedBGTargets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComputedBGTargets.swift; sourceTree = "<group>"; };
-		3B5CD2A82D4AEA6600CE213C /* Autotune.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Autotune.swift; sourceTree = "<group>"; };
 		3B5CD2AD2D4AEA6600CE213C /* ComputedInsulinSensitivities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComputedInsulinSensitivities.swift; sourceTree = "<group>"; };
 		3B5CD2AF2D4AEA6600CE213C /* Profile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Profile.swift; sourceTree = "<group>"; };
 		3B5CD2C12D4AECD500CE213C /* ProfileBasalTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileBasalTests.swift; sourceTree = "<group>"; };
@@ -2382,7 +2380,6 @@
 		3B5CD2B22D4AEA6600CE213C /* Models */ = {
 			isa = PBXGroup;
 			children = (
-				3B5CD2A82D4AEA6600CE213C /* Autotune.swift */,
 				3B5CD2A72D4AEA6600CE213C /* ComputedBGTargets.swift */,
 				3B5CD2AD2D4AEA6600CE213C /* ComputedInsulinSensitivities.swift */,
 				3B5CD2AF2D4AEA6600CE213C /* Profile.swift */,
@@ -3621,7 +3618,6 @@
 				BDC2EA452C3043B000E5BBD0 /* OverrideStorage.swift in Sources */,
 				3811DE4225C9D4A100A708ED /* SettingsDataFlow.swift in Sources */,
 				CEE9A6562BBB418300EB5194 /* CalibrationsRootView.swift in Sources */,
-				3B5CD2B32D4AEA6600CE213C /* Autotune.swift in Sources */,
 				3B5CD2B72D4AEA6600CE213C /* ComputedBGTargets.swift in Sources */,
 				3B5CD2B82D4AEA6600CE213C /* ComputedInsulinSensitivities.swift in Sources */,
 				3B5CD2BE2D4AEA6600CE213C /* Profile.swift in Sources */,

+ 0 - 1
FreeAPS/Sources/APS/OpenAPS/OpenAPS.swift

@@ -761,7 +761,6 @@ final class OpenAPS {
             carbRatio: carbRatio,
             tempTargets: tempTargets,
             model: model,
-            autotune: autotune,
             freeaps: freeaps
         )
         let nativeDuration = Date().timeIntervalSince(startNativeAt)

+ 0 - 5
FreeAPS/Sources/APS/OpenAPSSwift/JSONBridge.swift

@@ -39,11 +39,6 @@ enum JSONBridge {
         from.rawJSON
     }
 
-    static func autotune(from: JSON) throws -> Autotune? {
-        guard from.rawJSON != RawJSON.null else { return nil }
-        return try JSONBridge.from(string: from.rawJSON)
-    }
-
     static func freeapsSettings(from: JSON) throws -> FreeAPSSettings {
         try JSONBridge.from(string: from.rawJSON)
     }

+ 0 - 19
FreeAPS/Sources/APS/OpenAPSSwift/Models/Autotune.swift

@@ -1,19 +0,0 @@
-import Foundation
-
-struct Autotune: Codable {
-    var createdAt: Date?
-    let basalProfile: [BasalProfileEntry]?
-    let isfProfile: ComputedInsulinSensitivities?
-    let sensitivity: Double
-    let carbRatio: Double?
-}
-
-extension Autotune {
-    private enum CodingKeys: String, CodingKey {
-        case createdAt = "created_at"
-        case basalProfile = "basalprofile"
-        case sensitivity = "sens"
-        case carbRatio = "carb_ratio"
-        case isfProfile
-    }
-}

+ 0 - 3
FreeAPS/Sources/APS/OpenAPSSwift/OpenAPSSwift.swift

@@ -10,7 +10,6 @@ struct OpenAPSSwift {
         carbRatio: JSON,
         tempTargets: JSON,
         model: JSON,
-        autotune: JSON,
         freeaps: JSON
     ) -> RawJSON {
         do {
@@ -22,7 +21,6 @@ struct OpenAPSSwift {
             let carbRatio = try JSONBridge.carbRatios(from: carbRatio)
             let tempTargets = try JSONBridge.tempTargets(from: tempTargets)
             let model = JSONBridge.model(from: model)
-            let autotune = try JSONBridge.autotune(from: autotune)
             let freeaps = try JSONBridge.freeapsSettings(from: freeaps)
 
             let profile = try ProfileGenerator.generate(
@@ -34,7 +32,6 @@ struct OpenAPSSwift {
                 carbRatios: carbRatio,
                 tempTargets: tempTargets,
                 model: model,
-                autotune: autotune,
                 freeaps: freeaps
             )
 

+ 0 - 1
FreeAPS/Sources/APS/OpenAPSSwift/Profile/ProfileGenerator.swift

@@ -74,7 +74,6 @@ enum ProfileGenerator {
         carbRatios: CarbRatios,
         tempTargets: [TempTarget],
         model: String,
-        autotune _: Autotune?,
         freeaps _: FreeAPSSettings
     ) throws -> Profile {
         let model = model.replacingOccurrences(of: "\"", with: "").trimmingCharacters(in: .whitespacesAndNewlines)

+ 8 - 17
FreeAPSTests/OpenAPSSwiftTests/ProfileJavascriptTests.swift

@@ -13,7 +13,6 @@ struct ProfileGeneratorTests {
         CarbRatios,
         [TempTarget],
         String,
-        Autotune?,
         FreeAPSSettings
     ) {
         let pumpSettings = PumpSettings(
@@ -53,10 +52,9 @@ struct ProfileGeneratorTests {
 
         let tempTargets: [TempTarget] = []
         let model = "523"
-        let autotune: Autotune? = nil
         let freeaps = FreeAPSSettings()
 
-        return (pumpSettings, bgTargets, basalProfile, isf, preferences, carbRatios, tempTargets, model, autotune, freeaps)
+        return (pumpSettings, bgTargets, basalProfile, isf, preferences, carbRatios, tempTargets, model, freeaps)
     }
 
     @Test("Basic profile generation should create profile with correct values") func testBasicProfileGeneration() throws {
@@ -71,8 +69,7 @@ struct ProfileGeneratorTests {
             carbRatios: inputs.5,
             tempTargets: inputs.6,
             model: inputs.7,
-            autotune: inputs.8,
-            freeaps: inputs.9
+            freeaps: inputs.8
         )
 
         #expect(profile.maxIob == 0)
@@ -115,8 +112,7 @@ struct ProfileGeneratorTests {
             carbRatios: inputs.5,
             tempTargets: inputs.6,
             model: inputs.7,
-            autotune: inputs.8,
-            freeaps: inputs.9
+            freeaps: inputs.8
         )
 
         #expect(profile.maxIob == 0)
@@ -160,8 +156,7 @@ struct ProfileGeneratorTests {
             carbRatios: inputs.5,
             tempTargets: inputs.6,
             model: inputs.7,
-            autotune: inputs.8,
-            freeaps: inputs.9
+            freeaps: inputs.8
         )
 
         #expect(profile.maxIob == 0)
@@ -204,8 +199,7 @@ struct ProfileGeneratorTests {
             carbRatios: inputs.5,
             tempTargets: inputs.6,
             model: inputs.7,
-            autotune: inputs.8,
-            freeaps: inputs.9
+            freeaps: inputs.8
         )
 
         #expect(profile.maxIob == 0)
@@ -235,8 +229,7 @@ struct ProfileGeneratorTests {
                 carbRatios: inputs.5,
                 tempTargets: inputs.6,
                 model: inputs.7,
-                autotune: inputs.8,
-                freeaps: inputs.9
+                freeaps: inputs.8
             )
         }
     }
@@ -257,8 +250,7 @@ struct ProfileGeneratorTests {
                 carbRatios: inputs.5,
                 tempTargets: inputs.6,
                 model: inputs.7,
-                autotune: inputs.8,
-                freeaps: inputs.9
+                freeaps: inputs.8
             )
         }
     }
@@ -276,8 +268,7 @@ struct ProfileGeneratorTests {
             carbRatios: inputs.5,
             tempTargets: inputs.6,
             model: inputs.7,
-            autotune: inputs.8,
-            freeaps: inputs.9
+            freeaps: inputs.8
         )
 
         #expect(profile.model == "554")