diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.java index d85a383752..3ad7ed6ab8 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PumpInterface.java @@ -122,4 +122,8 @@ public interface PumpInterface { default boolean isUnreachableAlertTimeoutExceeded(long alertTimeoutMilliseconds) { return false; } + + default boolean setNeutralTempAtFullHour() { + return false; + } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.java index 16949fcb4c..f37f85d26b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.java @@ -26,18 +26,16 @@ import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.data.MealData; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.db.TemporaryBasal; +import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; -import info.nightscout.androidaps.plugins.aps.loop.ScriptReader; import info.nightscout.androidaps.plugins.aps.logger.LoggerCallback; -import info.nightscout.androidaps.plugins.common.ManufacturerType; +import info.nightscout.androidaps.plugins.aps.loop.ScriptReader; import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker; import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin; -import info.nightscout.androidaps.interfaces.ActivePluginProvider; - import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.utils.SafeParse; import info.nightscout.androidaps.utils.resources.ResourceHelper; @@ -240,7 +238,6 @@ public class DetermineBasalAdapterSMBJS { String units = profile.getUnits(); PumpInterface pump = activePluginProvider.getActivePump(); - ManufacturerType manufacturer = pump.manufacturer(); Double pumpbolusstep = pump.getPumpDescription().bolusStep; mProfile = new JSONObject(); @@ -269,11 +266,7 @@ public class DetermineBasalAdapterSMBJS { mProfile.put("exercise_mode", SMBDefaults.exercise_mode); mProfile.put("half_basal_exercise_target", SMBDefaults.half_basal_exercise_target); mProfile.put("maxCOB", SMBDefaults.maxCOB); - if (!manufacturer.name().equals("Medtronic")) { - mProfile.put("skip_neutral_temps",SMBDefaults.skip_neutral_temps); - } else { - mProfile.put("skip_neutral_temps", sp.getBoolean(R.string.key_skip_neutral_temps, SMBDefaults.skip_neutral_temps_medtronic)); - } + mProfile.put("skip_neutral_temps", !pump.setNeutralTempAtFullHour()); // min_5m_carbimpact is not used within SMB determinebasal //if (mealData.usedMinCarbsImpact > 0) { // mProfile.put("min_5m_carbimpact", mealData.usedMinCarbsImpact); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/SMBDefaults.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/SMBDefaults.java index 42eacdbce6..83ef09f89a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/SMBDefaults.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/SMBDefaults.java @@ -37,8 +37,7 @@ public class SMBDefaults { // (If someone enters more carbs or stacks more; OpenAPS will just truncate dosing based on 120. // Essentially, this just limits AMA/SMB as a safety cap against excessive COB entry) public final static int maxCOB = 120; - public final static boolean skip_neutral_temps = true; // ***** default false in oref1 ***** if true, don't set neutral temps - public final static boolean skip_neutral_temps_medtronic = false;//if using a medtronic pump default to false so the pump doesnt beep on the hour + //public final static boolean skip_neutral_temps = true; // ***** default false in oref1 ***** if true, don't set neutral temps // unsuspend_if_no_temp:false // if true, pump will un-suspend after a zero temp finishes // bolussnooze_dia_divisor:2 // bolus snooze decays after 1/2 of DIA public final static double min_5m_carbimpact = 8d; // mg/dL per 5m (8 mg/dL/5m corresponds to 24g/hr at a CSF of 4 mg/dL/g (x/5*60/4)) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java index 4bb5609f33..8f997b9b58 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java @@ -1558,6 +1558,10 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter this.hasTimeDateOrTimeZoneChanged = true; } + @Override public boolean setNeutralTempAtFullHour() { + return sp.getBoolean(R.string.key_set_neutral_temps, true); + } + private void setEnableCustomAction(MedtronicCustomActionType customAction, boolean isEnabled) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1561f13835..8f84bd2b87 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -958,9 +958,9 @@ enableSMB_with_temptarget enableSMB_after_carbs enableSMB_with_high_temptarget - skip_neutral_temps - Skip neutral temp basals - If enabled, it skips setting basal to neutral before the end of each hour. This method can help stop some pumps beeping/vibrating on the hour. + set_neutral_temps + Set neutral temp basals + If enabled, it sets basal to neutral before the end of each hour. This method can help stop some pumps beeping/vibrating on the hour. Enable SMB always Enable SMB always independently to boluses. Possible only with BG source with nice filtering of data like G5 Enable SMB after carbs diff --git a/app/src/main/res/xml/pref_medtronic.xml b/app/src/main/res/xml/pref_medtronic.xml index c5f4562e1d..342250d046 100644 --- a/app/src/main/res/xml/pref_medtronic.xml +++ b/app/src/main/res/xml/pref_medtronic.xml @@ -99,10 +99,10 @@ + android:defaultValue="true" + android:key="@string/key_set_neutral_temps" + android:summary="@string/set_neutral_temps_summary" + android:title="@string/set_neutral_temps_title" />