ソースを参照

Revert FPU guardrails

Old guardrails in Trio v0.x and this commit:
`Fat and Protein Delay`: 60 - 120
`Maximum Duration`: 5 - 12
`Spread Interval`: 10 - 60
`Fat and Protein Percentage`: 0.1 - 1.2

Guardrails in Trio-dev before this PR:
`Fat and Protein Delay`: [30] - 120
`Maximum Duration`: 5 - 12
`Spread Interval`: [5] - 60
`Fat and Protein Percentage`: 0.1 - [2]

Also:
* Update `minuteInterval` default picker value to match JSON default
* Reduce step for `Fat and Protein Delay` from `15` to `10`
* Add default values for FPU settings in `MealSettingsStateModel.swift` since they were all just 0
* Remove redundant guardrail for `Fat and Protein Percentage` in `MealSettingsStateModel.swift`
* Update verboseHint of `Fat and Protein Percentage`:
  * Remove:
    > **200% is double effect:**
    > (Fat × 180%) + (Protein x 80%)
  * Replace with:
    > **110% makes fat-to-carbs ratio essentially equal:**
    > (Fat × 99%) + (Protein x 44%)")
Mike Plante 1 年間 前
コミット
e3c87f8ade

+ 3 - 3
FreeAPS/Sources/Models/DecimalPickerSettings.swift

@@ -40,7 +40,7 @@ struct DecimalPickerSettings {
         value: 0.5,
         step: 0.05,
         min: 0.1,
-        max: 2,
+        max: 1.2,
         type: PickerSetting.PickerSettingType.factor
     )
     var high = PickerSetting(value: 180, step: 1, min: 100, max: 500, type: PickerSetting.PickerSettingType.glucose)
@@ -130,8 +130,8 @@ struct DecimalPickerSettings {
     )
     var threshold_setting = PickerSetting(value: 60, step: 1, min: 60, max: 120, type: PickerSetting.PickerSettingType.glucose)
     var updateInterval = PickerSetting(value: 20, step: 5, min: 1, max: 60, type: PickerSetting.PickerSettingType.minute)
-    var delay = PickerSetting(value: 60, step: 15, min: 30, max: 120, type: PickerSetting.PickerSettingType.minute)
-    var minuteInterval = PickerSetting(value: 20, step: 5, min: 5, max: 60, type: PickerSetting.PickerSettingType.minute)
+    var delay = PickerSetting(value: 60, step: 10, min: 60, max: 120, type: PickerSetting.PickerSettingType.minute)
+    var minuteInterval = PickerSetting(value: 30, step: 5, min: 10, max: 60, type: PickerSetting.PickerSettingType.minute)
     var timeCap = PickerSetting(value: 8, step: 1, min: 5, max: 12, type: PickerSetting.PickerSettingType.hour)
     var hours = PickerSetting(value: 6, step: 0.5, min: 2, max: 24, type: PickerSetting.PickerSettingType.hour)
     var dia = PickerSetting(value: 10, step: 0.5, min: 5, max: 10, type: PickerSetting.PickerSettingType.hour)

+ 5 - 6
FreeAPS/Sources/Modules/MealSettings/MealSettingsStateModel.swift

@@ -7,10 +7,10 @@ extension MealSettings {
         @Published var maxCarbs: Decimal = 250
         @Published var maxFat: Decimal = 250
         @Published var maxProtein: Decimal = 250
-        @Published var individualAdjustmentFactor: Decimal = 0
-        @Published var timeCap: Decimal = 0
-        @Published var minuteInterval: Decimal = 0
-        @Published var delay: Decimal = 0
+        @Published var individualAdjustmentFactor: Decimal = 0.5
+        @Published var timeCap: Decimal = 8
+        @Published var minuteInterval: Decimal = 30
+        @Published var delay: Decimal = 60
 
         override func subscribe() {
             units = settingsManager.settings.units
@@ -38,8 +38,7 @@ extension MealSettings {
             })
 
             subscribeSetting(\.individualAdjustmentFactor, on: $individualAdjustmentFactor, initial: {
-                let value = max(min($0, 1.2), 0.1)
-                individualAdjustmentFactor = value
+                individualAdjustmentFactor = $0
             }, map: {
                 $0
             })

+ 2 - 2
FreeAPS/Sources/Modules/MealSettings/View/MealSettingsRootView.swift

@@ -344,8 +344,8 @@ extension MealSettings {
                                     Text("(Fat × 45%) + (Protein × 20%)")
                                     Text("100% is full effect:").bold()
                                     Text("(Fat × 90%) + (Protein × 40%)")
-                                    Text("200% is double effect:").bold()
-                                    Text("(Fat × 180%) + (Protein x 80%)")
+                                    Text("110% makes fat-to-carbs ratio essentially equal:").bold()
+                                    Text("(Fat × 99%) + (Protein x 44%)")
                                 }
                                 Text(
                                     "Tip: You may find that your normal carb ratio needs to increase to a larger number when you begin adding fat and protein entries. For this reason, it is best to start with a factor of about 50%."