extend pump interface for neutral temps

This commit is contained in:
Milos Kozak 2020-05-11 14:50:35 +02:00
parent 1598d0c45e
commit 441e5fdf3e
6 changed files with 19 additions and 19 deletions

View file

@ -122,4 +122,8 @@ public interface PumpInterface {
default boolean isUnreachableAlertTimeoutExceeded(long alertTimeoutMilliseconds) { default boolean isUnreachableAlertTimeoutExceeded(long alertTimeoutMilliseconds) {
return false; return false;
} }
default boolean setNeutralTempAtFullHour() {
return false;
}
} }

View file

@ -26,18 +26,16 @@ import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.MealData; import info.nightscout.androidaps.data.MealData;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag; 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.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.ConstraintChecker;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction; import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin; 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.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.SafeParse; import info.nightscout.androidaps.utils.SafeParse;
import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper;
@ -240,7 +238,6 @@ public class DetermineBasalAdapterSMBJS {
String units = profile.getUnits(); String units = profile.getUnits();
PumpInterface pump = activePluginProvider.getActivePump(); PumpInterface pump = activePluginProvider.getActivePump();
ManufacturerType manufacturer = pump.manufacturer();
Double pumpbolusstep = pump.getPumpDescription().bolusStep; Double pumpbolusstep = pump.getPumpDescription().bolusStep;
mProfile = new JSONObject(); mProfile = new JSONObject();
@ -269,11 +266,7 @@ public class DetermineBasalAdapterSMBJS {
mProfile.put("exercise_mode", SMBDefaults.exercise_mode); mProfile.put("exercise_mode", SMBDefaults.exercise_mode);
mProfile.put("half_basal_exercise_target", SMBDefaults.half_basal_exercise_target); mProfile.put("half_basal_exercise_target", SMBDefaults.half_basal_exercise_target);
mProfile.put("maxCOB", SMBDefaults.maxCOB); mProfile.put("maxCOB", SMBDefaults.maxCOB);
if (!manufacturer.name().equals("Medtronic")) { mProfile.put("skip_neutral_temps", !pump.setNeutralTempAtFullHour());
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));
}
// min_5m_carbimpact is not used within SMB determinebasal // min_5m_carbimpact is not used within SMB determinebasal
//if (mealData.usedMinCarbsImpact > 0) { //if (mealData.usedMinCarbsImpact > 0) {
// mProfile.put("min_5m_carbimpact", mealData.usedMinCarbsImpact); // mProfile.put("min_5m_carbimpact", mealData.usedMinCarbsImpact);

View file

@ -37,8 +37,7 @@ public class SMBDefaults {
// (If someone enters more carbs or stacks more; OpenAPS will just truncate dosing based on 120. // (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) // Essentially, this just limits AMA/SMB as a safety cap against excessive COB entry)
public final static int maxCOB = 120; 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 = 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
// unsuspend_if_no_temp:false // if true, pump will un-suspend after a zero temp finishes // 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 // 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)) 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))

View file

@ -1558,6 +1558,10 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
this.hasTimeDateOrTimeZoneChanged = true; this.hasTimeDateOrTimeZoneChanged = true;
} }
@Override public boolean setNeutralTempAtFullHour() {
return sp.getBoolean(R.string.key_set_neutral_temps, true);
}
private void setEnableCustomAction(MedtronicCustomActionType customAction, boolean isEnabled) { private void setEnableCustomAction(MedtronicCustomActionType customAction, boolean isEnabled) {

View file

@ -958,9 +958,9 @@
<string name="key_enableSMB_with_temptarget" translatable="false">enableSMB_with_temptarget</string> <string name="key_enableSMB_with_temptarget" translatable="false">enableSMB_with_temptarget</string>
<string name="key_enableSMB_after_carbs" translatable="false">enableSMB_after_carbs</string> <string name="key_enableSMB_after_carbs" translatable="false">enableSMB_after_carbs</string>
<string name="key_allowSMB_with_high_temptarget" translatable="false">enableSMB_with_high_temptarget</string> <string name="key_allowSMB_with_high_temptarget" translatable="false">enableSMB_with_high_temptarget</string>
<string name="key_skip_neutral_temps" translatable="false">skip_neutral_temps</string> <string name="key_set_neutral_temps" translatable="false">set_neutral_temps</string>
<string name="skip_neutral_temps_title">Skip neutral temp basals</string> <string name="set_neutral_temps_title">Set neutral temp basals</string>
<string name="skip_neutral_temps_summary">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.</string> <string name="set_neutral_temps_summary">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.</string>
<string name="enablesmbalways">Enable SMB always</string> <string name="enablesmbalways">Enable SMB always</string>
<string name="enablesmbalways_summary">Enable SMB always independently to boluses. Possible only with BG source with nice filtering of data like G5</string> <string name="enablesmbalways_summary">Enable SMB always independently to boluses. Possible only with BG source with nice filtering of data like G5</string>
<string name="enablesmbaftercarbs">Enable SMB after carbs</string> <string name="enablesmbaftercarbs">Enable SMB after carbs</string>

View file

@ -99,10 +99,10 @@
</Preference> </Preference>
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="true"
android:key="@string/key_skip_neutral_temps" android:key="@string/key_set_neutral_temps"
android:summary="@string/skip_neutral_temps_summary" android:summary="@string/set_neutral_temps_summary"
android:title="@string/skip_neutral_temps_title" /> android:title="@string/set_neutral_temps_title" />
</PreferenceCategory> </PreferenceCategory>