diff --git a/Config.xcconfig b/Config.xcconfig index 8a615cf591..1ae59429d9 100644 --- a/Config.xcconfig +++ b/Config.xcconfig @@ -1,5 +1,5 @@ APP_DISPLAY_NAME = iAPS -APP_VERSION = 5.2.1 +APP_VERSION = 5.2.2 APP_BUILD_NUMBER = 1 COPYRIGHT_NOTICE = DEVELOPER_TEAM = ##TEAM_ID## diff --git a/FreeAPS/Resources/javascript/prepare/determine-basal.js b/FreeAPS/Resources/javascript/prepare/determine-basal.js index 2b463512d3..2c5b5a4610 100644 --- a/FreeAPS/Resources/javascript/prepare/determine-basal.js +++ b/FreeAPS/Resources/javascript/prepare/determine-basal.js @@ -27,13 +27,23 @@ function generate(iob, currenttemp, glucose, profile, autosens = null, meal = nu profile.current_basal *= factor; // ISF and CR if (dynamicVariables.isfAndCr) { - profile.sense /= factor; + profile.sens /= factor; profile.carb_ratio = round(profile.carb_ratio / factor, 1); + console.log("Override Active, " + dynamicVariables.overridePercentage + "%"); } else { - if (dynamicVariables.cr) { profile.carb_ratio = round(profile.carb_ratio / factor, 1); } - if (dynamicVariables.isf) { profile.sens /= factor; } + if (dynamicVariables.cr) { + profile.carb_ratio = round(profile.carb_ratio / factor, 1); + console.log("Override Active, CR: " + profile.old_cr + " → " + profile.carb_ratio); + } + if (dynamicVariables.isf) { + profile.sens /= factor; + if (profile.out_units == 'mmol/L') { + console.log("Override Active, ISF: " + profile.old_isf + " → " + Math.round(profile.sens * 0.0555 * 10) / 10); + } else { + console.log("Override Active, ISF: " + profile.old_isf + " → " + profile.sens); + } + } } - console.log("Override Active, " + dynamicVariables.overridePercentage + "%"); } // SMB Minutes if (dynamicVariables.advancedSettings && dynamicVariables.smbMinutes !== profile.maxSMBBasalMinutes) { diff --git a/FreeAPS/Resources/javascript/prepare/middleware.js b/FreeAPS/Resources/javascript/prepare/middleware.js index 21851fef05..e4f528ab44 100644 --- a/FreeAPS/Resources/javascript/prepare/middleware.js +++ b/FreeAPS/Resources/javascript/prepare/middleware.js @@ -18,14 +18,13 @@ function generate(iob, currenttemp, glucose, profile, autosens = null, meal = nu profile.tdd_factor = adjusted; } } - + + profile.old_cr = profile.carb_ratio; + profile.old_isf = profile.sens; if (profile.out_units == 'mmol/L') { profile.old_isf = Math.round(profile.sens * 0.0555 * 10) / 10; - } else { - profile.old_isf = profile.sens; } - profile.old_cr = profile.carb_ratio; - + if (profile.useNewFormula && profile.temptargetSet && (profile.high_temptarget_raises_sensitivity || profile.exercise_mode || dynamicVariables.isEnabled) && profile.min_bg >= 118) { profile.useNewFormula = false; console.log("Dynamic ISF disabled due to an active exercise "); diff --git a/FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings b/FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings index 0adfb4f129..1a875d1c09 100644 --- a/FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings +++ b/FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings @@ -92,7 +92,7 @@ "Suggested at" = "Vorgeschlagen um"; /* Headline in enacted pop up (at: at what time) */ -"Status at" = "Status at"; +"Status at" = "Status vom"; /* Bolus View Meal Summary Header */ "Meal Summary" = "Mahlzeitenübersicht"; @@ -642,7 +642,7 @@ Enact a temp Basal or a temp target */ "Treatments" = "Behandlungen"; /* Hypo Treatment Preset */ -"Treatment" = "Treatment"; +"Treatment" = "Behandlung"; /* " min" in Treatments list */ " min" = " Min"; @@ -1252,7 +1252,7 @@ Enact a temp Basal or a temp target */ "Can't enact the new loop cycle recommendation, because a Bolus is in progress. Wait for next loop cycle" = "Die neue Empfehlung kann nicht angewendet werden, da zurzeit ein Bolus verabreicht wird. Warten Sie bitte die nächste Schleife ab."; /* Pump Error */ -"Pump is Busy." = "Pump is Busy."; +"Pump is Busy." = "Die Insulinpumpe ist beschäftigt."; /* -------------- Developer settings ---------------------- */ /* Debug options */ diff --git a/FreeAPS/Sources/Modules/Home/View/Previews/TIRView.swift b/FreeAPS/Sources/Modules/Home/View/Previews/TIRView.swift index 6078bb9e95..7e0c1b06d1 100644 --- a/FreeAPS/Sources/Modules/Home/View/Previews/TIRView.swift +++ b/FreeAPS/Sources/Modules/Home/View/Previews/TIRView.swift @@ -17,64 +17,66 @@ struct PreviewChart: View { } var body: some View { - VStack { - let padding: CGFloat = 40 - // Prepare the chart data - let data = prepareData() - HStack { - Text("Today") - }.padding(.bottom, 15).font(.previewHeadline) + if !readings.isEmpty { + VStack { + let padding: CGFloat = 40 + // Prepare the chart data + let data = prepareData() + HStack { + Text("Today") + }.padding(.bottom, 15).font(.previewHeadline) - HStack { - Chart(data) { item in - BarMark( - x: .value("TIR", item.type), - y: .value("Percentage", item.percentage), - width: .fixed(65) - ) - .foregroundStyle(by: .value("Group", item.group)) - .clipShape( - UnevenRoundedRectangle( - topLeadingRadius: (item.last || item.percentage == 100) ? 4 : 0, - bottomLeadingRadius: (item.first || item.percentage == 100) ? 4 : 0, - bottomTrailingRadius: (item.first || item.percentage == 100) ? 4 : 0, - topTrailingRadius: (item.last || item.percentage == 100) ? 4 : 0 + HStack { + Chart(data) { item in + BarMark( + x: .value("TIR", item.type), + y: .value("Percentage", item.percentage), + width: .fixed(65) ) - ) - } - .chartForegroundStyleScale([ - NSLocalizedString( - "Low", - comment: "" - ): .red, - NSLocalizedString("In Range", comment: ""): .darkGreen, - NSLocalizedString( - "High", - comment: "" - ): .yellow, - NSLocalizedString( - "Very High", - comment: "" - ): .red, - NSLocalizedString( - "Very Low", - comment: "" - ): .darkRed, - "Separator": colorScheme == .dark ? .black : .white - ]) - .chartXAxis(.hidden) - .chartYAxis(.hidden) - .chartLegend(.hidden) - .padding(.bottom, 15) - .padding(.leading, padding) - .frame(maxWidth: (UIScreen.main.bounds.width / 5) + padding) + .foregroundStyle(by: .value("Group", item.group)) + .clipShape( + UnevenRoundedRectangle( + topLeadingRadius: (item.last || item.percentage == 100) ? 4 : 0, + bottomLeadingRadius: (item.first || item.percentage == 100) ? 4 : 0, + bottomTrailingRadius: (item.first || item.percentage == 100) ? 4 : 0, + topTrailingRadius: (item.last || item.percentage == 100) ? 4 : 0 + ) + ) + } + .chartForegroundStyleScale([ + NSLocalizedString( + "Low", + comment: "" + ): .red, + NSLocalizedString("In Range", comment: ""): .darkGreen, + NSLocalizedString( + "High", + comment: "" + ): .yellow, + NSLocalizedString( + "Very High", + comment: "" + ): .red, + NSLocalizedString( + "Very Low", + comment: "" + ): .darkRed, + "Separator": colorScheme == .dark ? .black : .white + ]) + .chartXAxis(.hidden) + .chartYAxis(.hidden) + .chartLegend(.hidden) + .padding(.bottom, 15) + .padding(.leading, padding) + .frame(maxWidth: (UIScreen.main.bounds.width / 5) + padding) - sumView(data).offset(x: 0, y: -7) - } + sumView(data).offset(x: 0, y: -7) + } - }.frame(maxHeight: 180) - .padding(.top, 20) - .dynamicTypeSize(...DynamicTypeSize.xLarge) + }.frame(maxHeight: 180) + .padding(.top, 20) + .dynamicTypeSize(...DynamicTypeSize.xLarge) + } } @ViewBuilder private func sumView(_ data: [TIRinPercent]) -> some View { diff --git a/FreeAPS/Sources/Modules/OverrideProfilesConfig/OverrideProfilesStateModel.swift b/FreeAPS/Sources/Modules/OverrideProfilesConfig/OverrideProfilesStateModel.swift index fb9fcf4990..c6295a715c 100644 --- a/FreeAPS/Sources/Modules/OverrideProfilesConfig/OverrideProfilesStateModel.swift +++ b/FreeAPS/Sources/Modules/OverrideProfilesConfig/OverrideProfilesStateModel.swift @@ -83,11 +83,11 @@ extension OverrideProfilesConfig { } else { saveOverride.target = 6 } if advancedSettings { saveOverride.advancedSettings = true + saveOverride.isfAndCr = isfAndCr if !isfAndCr { - saveOverride.isfAndCr = false saveOverride.isf = isf saveOverride.cr = cr - } else { saveOverride.isfAndCr = true } + } if smbIsAlwaysOff { saveOverride.smbIsAlwaysOff = true saveOverride.start = start as NSDecimalNumber @@ -128,23 +128,23 @@ extension OverrideProfilesConfig { ) as NSDecimalNumber } else { saveOverride.target = 6 } - if advancedSettings { + if self.advancedSettings { saveOverride.advancedSettings = true + saveOverride.isfAndCr = self.isfAndCr if !isfAndCr { - saveOverride.isfAndCr = false - saveOverride.isf = isf - saveOverride.cr = cr - } else { saveOverride.isfAndCr = true } + saveOverride.isf = self.isf + saveOverride.cr = self.cr + } if smbIsAlwaysOff { saveOverride.smbIsAlwaysOff = true saveOverride.start = start as NSDecimalNumber saveOverride.end = end as NSDecimalNumber } else { smbIsAlwaysOff = false } - saveOverride.smbMinutes = smbMinutes as NSDecimalNumber - saveOverride.uamMinutes = uamMinutes as NSDecimalNumber + saveOverride.smbMinutes = self.smbMinutes as NSDecimalNumber + saveOverride.uamMinutes = self.uamMinutes as NSDecimalNumber saveOverride.maxIOB = maxIOB as NSDecimalNumber - saveOverride.overrideMaxIOB = overrideMaxIOB + saveOverride.overrideMaxIOB = self.overrideMaxIOB } try? self.coredataContext.save() } @@ -177,6 +177,8 @@ extension OverrideProfilesConfig { saveOverride.isPreset = true saveOverride.date = Date() saveOverride.id = id_ + saveOverride.advancedSettings = profile.advancedSettings + saveOverride.isfAndCr = profile.isfAndCr if let tar = profile.target, tar == 0 { saveOverride.target = 6 @@ -185,12 +187,10 @@ extension OverrideProfilesConfig { } if profile.advancedSettings { - saveOverride.advancedSettings = true - if !isfAndCr { - saveOverride.isfAndCr = false + if !profile.isfAndCr { saveOverride.isf = profile.isf saveOverride.cr = profile.cr - } else { saveOverride.isfAndCr = true } + } if profile.smbIsAlwaysOff { saveOverride.smbIsAlwaysOff = true saveOverride.start = profile.start diff --git a/FreeAPS/Sources/Modules/OverrideProfilesConfig/View/OverrideProfilesRootView.swift b/FreeAPS/Sources/Modules/OverrideProfilesConfig/View/OverrideProfilesRootView.swift index 8118dc74ac..5a34c79d2f 100644 --- a/FreeAPS/Sources/Modules/OverrideProfilesConfig/View/OverrideProfilesRootView.swift +++ b/FreeAPS/Sources/Modules/OverrideProfilesConfig/View/OverrideProfilesRootView.swift @@ -301,8 +301,10 @@ extension OverrideProfilesConfig { } } .dynamicTypeSize(...DynamicTypeSize.xxLarge) - .onAppear(perform: configureView) - .onAppear { state.savedSettings() } + .onAppear { + configureView() + state.savedSettings() + } .navigationBarTitle("Profiles") .navigationBarTitleDisplayMode(.inline) .navigationBarItems(trailing: Button("Close", action: state.hideModal))