From 34d21788784beec70774b5a92343eac630cdd839 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 5 Sep 2016 09:14:39 +0200 Subject: [PATCH 1/2] fix newextendedbolusdialog context --- .idea/misc.xml | 2 +- .../plugins/Overview/Dialogs/NewExtendedBolusDialog.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index fbb68289f4..5d19981032 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewExtendedBolusDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewExtendedBolusDialog.java index a0f9cc3329..41afa4c357 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewExtendedBolusDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewExtendedBolusDialog.java @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.Overview.Dialogs; +import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.os.Handler; @@ -89,7 +90,8 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli final Double finalInsulin = insulin; final int finalDurationInMinutes = durationInMinutes; - AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext()); + final Context context = getContext(); + AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(this.getContext().getString(R.string.confirmation)); builder.setMessage(confirmMessage); builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { @@ -100,7 +102,7 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli public void run() { PumpEnactResult result = pump.setExtendedBolus(finalInsulin, finalDurationInMinutes); if (!result.success) { - AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(getContext().getString(R.string.treatmentdeliveryerror)); builder.setMessage(result.comment); builder.setPositiveButton(getContext().getString(R.string.ok), null); From 47bff5ad5e3c5252b99204873f2c2dd1ac20ef28 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 5 Sep 2016 15:27:53 +0200 Subject: [PATCH 2/2] limit requests on openloop mode --- .../androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java index 46f25b6bad..f55898ff6a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java @@ -177,6 +177,13 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface { DetermineBasalResult determineBasalResult = determineBasalAdapterJS.invoke(); // Fix bug determine basal if (determineBasalResult.rate == 0d && determineBasalResult.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress()) determineBasalResult.changeRequested = false; + // limit requests on openloop mode + if (!MainApp.getConfigBuilder().isClosedModeEnabled()) { + if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResult.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRate()) < 0.1) + determineBasalResult.changeRequested = false; + if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResult.rate - MainApp.getConfigBuilder().getBaseBasalRate()) < 0.1) + determineBasalResult.changeRequested = false; + } determineBasalResult.iob = iobTotal;