Merge pull request #2602 from Tornado-Tim/skip-neutral-temps

WIP: Add skip Neutral Temps preference
This commit is contained in:
Milos Kozak 2020-05-27 23:16:42 +02:00 committed by GitHub
commit 49274ac0ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 6 deletions

View file

@ -26,16 +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.aps.loop.ScriptReader;
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
import info.nightscout.androidaps.interfaces.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;
@ -237,7 +237,8 @@ public class DetermineBasalAdapterSMBJS {
) throws JSONException {
String units = profile.getUnits();
Double pumpbolusstep = activePluginProvider.getActivePump().getPumpDescription().bolusStep;
PumpInterface pump = activePluginProvider.getActivePump();
Double pumpbolusstep = pump.getPumpDescription().bolusStep;
mProfile = new JSONObject();
mProfile.put("max_iob", maxIob);
@ -265,7 +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);
mProfile.put("skip_neutral_temps", SMBDefaults.skip_neutral_temps);
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);

View file

@ -1571,6 +1571,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) {

View file

@ -736,6 +736,9 @@
<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_allowSMB_with_high_temptarget" translatable="false">enableSMB_with_high_temptarget</string>
<string name="key_set_neutral_temps" translatable="false">set_neutral_temps</string>
<string name="set_neutral_temps_title">Set neutral temp basals</string>
<string name="set_neutral_temps_summary">If enabled, it will cancel a temporary basal 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_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>

View file

@ -98,6 +98,12 @@
<intent android:action="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEScanActivity" />
</Preference>
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_set_neutral_temps"
android:summary="@string/set_neutral_temps_summary"
android:title="@string/set_neutral_temps_title" />
</PreferenceCategory>
</androidx.preference.PreferenceScreen>

View file

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

View file

@ -37,7 +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 = 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))