diff --git a/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java b/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java index 0f712c787f..12eb5a1daf 100644 --- a/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java @@ -14,7 +14,6 @@ import android.text.TextUtils; import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.interfaces.PluginBase; -import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin; import info.nightscout.androidaps.plugins.Careportal.CareportalPlugin; import info.nightscout.androidaps.plugins.ConstraintsSafety.SafetyPlugin; import info.nightscout.androidaps.plugins.Insulin.InsulinOrefFreePeakPlugin; @@ -22,6 +21,7 @@ import info.nightscout.androidaps.plugins.Loop.LoopPlugin; import info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalPlugin; import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin; import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin; +import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin; @@ -65,7 +65,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre if (key.equals("short_tabtitles")) { MainApp.bus().post(new EventRefreshGui()); } - if (key.equals("openapsama_useautosens") && SP.getBoolean("openapsama_useautosens", false)) { + if (key.equals(MainApp.gs(R.string.key_openapsama_useautosens)) && SP.getBoolean(R.string.key_openapsama_useautosens, false)) { OKDialog.show(this, MainApp.sResources.getString(R.string.configbuilder_sensitivity), MainApp.sResources.getString(R.string.sensitivity_warning), null); } updatePrefSummary(myPreferenceFragment.getPreference(key)); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java index 808c8f696d..459111ed0d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java @@ -342,25 +342,4 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface { return maxIob; } - @Override - public Constraint applyBasalConstraints(Constraint absoluteRate, Profile profile) { - return absoluteRate; - } - - @Override - public Constraint applyBasalPercentConstraints(Constraint percentRate, Profile profile) { - return percentRate; - } - - @Override - public Constraint applyBolusConstraints(Constraint insulin) { - return insulin; - } - - @Override - public Constraint applyCarbsConstraints(Constraint carbs) { - return carbs; - } - - } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java index 15f0a13583..3316bfdc30 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyPlugin.java @@ -115,14 +115,9 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface { @Override public Constraint isAutosensModeEnabled(Constraint value) { - return value; - } - - @Override - public Constraint isAMAModeEnabled(Constraint value) { - boolean enabled = SP.getBoolean("openapsama_useautosens", false); + boolean enabled = SP.getBoolean(R.string.key_openapsama_useautosens, false); if (!enabled) - value.set(false, MainApp.gs(R.string.amadisabledinpreferences), this); + value.set(false, MainApp.gs(R.string.autosensdisabledinpreferences), this); return value; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java index f71f7483b0..0c92df635c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java @@ -251,7 +251,7 @@ public class DetermineBasalAdapterAMAJS { mMealData.put("boluses", mealData.boluses); mMealData.put("mealCOB", mealData.mealCOB); - if (MainApp.getConstraintChecker().isAMAModeEnabled().value()) { + if (MainApp.getConstraintChecker().isAutosensModeEnabled().value()) { mAutosensData = new JSONObject(); mAutosensData.put("ratio", autosensDataRatio); } else { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java index 879be19b36..2a51c53811 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java @@ -222,7 +222,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface { return; startPart = new Date(); - if (MainApp.getConstraintChecker().isAMAModeEnabled().value()) { + if (MainApp.getConstraintChecker().isAutosensModeEnabled().value()) { lastAutosensResult = IobCobCalculatorPlugin.getPlugin().detectSensitivityWithLock(IobCobCalculatorPlugin.oldestDataAvailable(), System.currentTimeMillis()); } else { lastAutosensResult = new AutosensResult(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java index e5a555c326..e644b13dc9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java @@ -300,7 +300,7 @@ public class DetermineBasalAdapterSMBJS { mMealData.put("lastCarbTime", mealData.lastCarbTime); - if (MainApp.getConstraintChecker().isAMAModeEnabled().value()) { + if (MainApp.getConstraintChecker().isAutosensModeEnabled().value()) { mAutosensData = new JSONObject(); mAutosensData.put("ratio", autosensDataRatio); } else { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java index ee93f000b0..8b2d17d49f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java @@ -224,7 +224,7 @@ public class OpenAPSSMBPlugin implements PluginBase, APSInterface { if (!checkOnlyHardLimits(pump.getBaseBasalRate(), "current_basal", 0.01, HardLimits.maxBasal())) return; startPart = new Date(); - if (MainApp.getConstraintChecker().isAMAModeEnabled().value()) { + if (MainApp.getConstraintChecker().isAutosensModeEnabled().value()) { lastAutosensResult = IobCobCalculatorPlugin.getPlugin().detectSensitivityWithLock(IobCobCalculatorPlugin.oldestDataAvailable(), System.currentTimeMillis()); } else { lastAutosensResult = new AutosensResult(); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3decf36d10..9e6bbe311b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -965,7 +965,7 @@ Pump is not temp basal capable No valid basal rate read from pump Closed loop mode disabled in preferences - AMA disabled in preferences + Autosens disabled in preferences SMB disabled in preferences Limiting basal rate to %.2f U/h because of %s pump limit @@ -988,5 +988,6 @@ hard limit treatmentssafety_maxcarbs unsafe usage + openapsama_useautosens diff --git a/app/src/main/res/xml/pref_openapsama.xml b/app/src/main/res/xml/pref_openapsama.xml index ee8a1d80bd..944f057919 100644 --- a/app/src/main/res/xml/pref_openapsama.xml +++ b/app/src/main/res/xml/pref_openapsama.xml @@ -19,7 +19,7 @@ android:title="@string/openapsma_maxiob_title" /> c = constraintChecker.isAMAModeEnabled(); - Assert.assertEquals(true, c.getReasons().contains("AMA disabled in preferences")); + Constraint c = constraintChecker.isAutosensModeEnabled(); + Assert.assertEquals(true, c.getReasons().contains("Autosens disabled in preferences")); + Assert.assertEquals(true, c.getReasons().contains("Objective 6 not started")); Assert.assertEquals(Boolean.FALSE, c.value()); } @@ -377,7 +379,7 @@ public class ConstraintsCheckerTest { when(MainApp.gs(R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences"); when(MainApp.gs(R.string.objectivenotstarted)).thenReturn("Objective %d not started"); when(MainApp.gs(R.string.novalidbasalrate)).thenReturn("No valid basal rate read from pump"); - when(MainApp.gs(R.string.amadisabledinpreferences)).thenReturn("AMA disabled in preferences"); + when(MainApp.gs(R.string.autosensdisabledinpreferences)).thenReturn("Autosens disabled in preferences"); when(MainApp.gs(R.string.smbdisabledinpreferences)).thenReturn("SMB disabled in preferences"); when(MainApp.gs(R.string.limitingbasalratio)).thenReturn("Limiting basal rate to %.2f U/h because of %s"); when(MainApp.gs(R.string.pumplimit)).thenReturn("pump limit");