Jelajahi Sumber

Use a weighted average of TDD and show this box in pop up.

Jon Mårtensson 4 tahun lalu
induk
melakukan
010c8833c6

File diff ditekan karena terlalu besar
+ 1 - 1
FreeAPS/Resources/javascript/bundle/determine-basal.js


File diff ditekan karena terlalu besar
+ 1 - 1
FreeAPS/Resources/javascript/bundle/profile.js


+ 4 - 0
FreeAPS/Sources/Models/Preferences.swift

@@ -66,6 +66,8 @@ struct Preferences: JSON {
     var enableChris: Bool = false
     var enableDynamicCR: Bool = false
     var useNewFormula: Bool = false
+    var useWeightedAverage: Bool = false
+    var weightPercentage: Decimal = 0.65
 }
 
 extension Preferences {
@@ -134,6 +136,8 @@ extension Preferences {
         case enableChris
         case enableDynamicCR
         case useNewFormula
+        case useWeightedAverage
+        case weightPercentage
     }
 }
 

+ 12 - 3
FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift

@@ -120,11 +120,20 @@ extension PreferencesEditor {
                     settable: self
                 ),
                 Field(
-                    displayName: "Use logarithmic formula",
+                    displayName: "Use Logarithmic Formula",
                     type: .boolean(keypath: \.useNewFormula),
                     infoText: NSLocalizedString(
-                        "Use logarithmic formula",
-                        comment: "Use logarithmic formula"
+                        "Use Logarithmic Formula",
+                        comment: "Use Logarithmic Formula"
+                    ),
+                    settable: self
+                ),
+                Field(
+                    displayName: "Weighted Average of TDD. Weight of past 24 hours of TDD",
+                    type: .decimal(keypath: \.weightPercentage),
+                    infoText: NSLocalizedString(
+                        "Default is 0.65 (65 %) of past 24 hours. The rest will be from 7 days TDD average (35 %). To only use past 24 hours, set this to 1.",
+                        comment: "Weight of past 24 hours of TDD"
                     ),
                     settable: self
                 )