diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.java
index 13c7f26efb..d37693d494 100644
--- a/app/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.java
+++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.java
@@ -6,9 +6,8 @@ package info.nightscout.androidaps.interfaces;
public class PumpDescription {
public static final int NONE = 0;
- public static final int PERCENT = 1;
- public static final int ABSOLUTE = 2;
- public static final int EXTENDED = 4;
+ public static final int PERCENT = 0x01;
+ public static final int ABSOLUTE = 0x02;
public boolean isBolusCapable = true;
public double bolusStep = 0.1d;
@@ -19,18 +18,17 @@ public class PumpDescription {
public double extendedBolusMaxDuration = 12 * 60;
public boolean isTempBasalCapable = true;
- public int lowTempBasalStyle = PERCENT;
- public int highTempBasalStyle = PERCENT;
- public int maxHighTempPercent = 200;
- public double maxHighTempAbsolute = 0; // zero = no limit
- public int lowTempPercentStep = 10;
- public double lowTempAbsoluteStep = 0.05d;
- public int lowTempPercentDuration = 30;
- public int lowTempAbsoluteDuration = 30;
- public double highTempPercentStep = 10;
- public double highTempAbsoluteStep = 0.05d;
- public int highTempPercentDuration = 30;
- public int highTempAbsoluteDuration = 30;
+ public int tempBasalStyle = PERCENT;
+
+ public int maxTempPercent = 200;
+ public int tempPercentStep = 10;
+
+ public double maxTempAbsolute = 10;
+ public double tempAbsoluteStep = 0.05d;
+
+ public int tempDurationStep = 60;
+ public int tempMaxDuration = 12 * 60;
+
public boolean isSetBasalProfileCapable = true;
public double basalStep = 0.01d;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java
index 6930a0de21..2a79ccef49 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java
@@ -11,11 +11,10 @@ import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
+import android.widget.RelativeLayout;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
@@ -26,6 +25,7 @@ import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.PumpEnactResult;
+import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile;
import info.nightscout.utils.PlusMinusEditText;
@@ -33,23 +33,17 @@ import info.nightscout.utils.SafeParse;
public class NewTempBasalDialog extends DialogFragment implements View.OnClickListener, RadioGroup.OnCheckedChangeListener {
- Button okButton;
- EditText basalPercentEdit;
- EditText basalAbsoluteEdit;
RadioButton percentRadio;
RadioButton absoluteRadio;
RadioGroup basalTypeRadioGroup;
- RadioButton h05Radio;
- RadioButton h10Radio;
- RadioButton h20Radio;
- RadioButton h30Radio;
- RadioButton h40Radio;
+ RelativeLayout typeSelectorLayout;
LinearLayout percentLayout;
LinearLayout absoluteLayout;
- PlusMinusEditText basalPercentPM;
- PlusMinusEditText basalAbsolutePM;
+ PlusMinusEditText basalPercent;
+ PlusMinusEditText basalAbsolute;
+ PlusMinusEditText duration;
Handler mHandler;
public static HandlerThread mHandlerThread;
@@ -66,31 +60,51 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
getDialog().setTitle(getString(R.string.overview_tempbasal_button));
View view = inflater.inflate(R.layout.overview_newtempbasal_dialog, container, false);
- okButton = (Button) view.findViewById(R.id.overview_newtempbasal_okbutton);
- basalPercentEdit = (EditText) view.findViewById(R.id.overview_newtempbasal_basalpercentinput);
- basalAbsoluteEdit = (EditText) view.findViewById(R.id.overview_newtempbasal_basalabsoluteinput);
+
percentLayout = (LinearLayout) view.findViewById(R.id.overview_newtempbasal_percent_layout);
absoluteLayout = (LinearLayout) view.findViewById(R.id.overview_newtempbasal_absolute_layout);
percentRadio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_percent_radio);
basalTypeRadioGroup = (RadioGroup) view.findViewById(R.id.overview_newtempbasal_radiogroup);
absoluteRadio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_absolute_radio);
- h05Radio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_05h);
- h10Radio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_1h);
- h20Radio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_2h);
- h30Radio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_3h);
- h40Radio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_4h);
+ typeSelectorLayout = (RelativeLayout) view.findViewById(R.id.overview_newtempbasal_typeselector_layout);
- Integer maxPercent = MainApp.getConfigBuilder().applyBasalConstraints(Constants.basalPercentOnlyForCheckLimit);
- basalPercentPM = new PlusMinusEditText(view, R.id.overview_newtempbasal_basalpercentinput, R.id.overview_newtempbasal_basalpercent_plus, R.id.overview_newtempbasal_basalpercent_minus, 100d, 0d, (double) maxPercent, 5d, new DecimalFormat("0"), true);
+ PumpDescription pumpDescription = MainApp.getConfigBuilder().getPumpDescription();
+
+ basalPercent = new PlusMinusEditText(view, R.id.overview_newtempbasal_basalpercentinput, R.id.overview_newtempbasal_basalpercent_plus, R.id.overview_newtempbasal_basalpercent_minus,
+ 100d, 0d, (double) pumpDescription.maxTempPercent, (double) pumpDescription.tempPercentStep, new DecimalFormat("0"), true);
- Double maxAbsolute = MainApp.getConfigBuilder().applyBasalConstraints(Constants.basalAbsoluteOnlyForCheckLimit);
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
Double currentBasal = 0d;
if (profile != null) currentBasal = profile.getBasal(NSProfile.secondsFromMidnight());
- basalAbsolutePM = new PlusMinusEditText(view, R.id.overview_newtempbasal_basalabsoluteinput, R.id.overview_newtempbasal_basalabsolute_plus, R.id.overview_newtempbasal_basalabsolute_minus, currentBasal, 0d, maxAbsolute, 0.05d, new DecimalFormat("0.00"), true);
+ basalAbsolute = new PlusMinusEditText(view, R.id.overview_newtempbasal_basalabsoluteinput, R.id.overview_newtempbasal_basalabsolute_plus, R.id.overview_newtempbasal_basalabsolute_minus,
+ currentBasal, 0d, pumpDescription.maxTempAbsolute, pumpDescription.tempAbsoluteStep, new DecimalFormat("0.00"), true);
- absoluteLayout.setVisibility(View.GONE);
- okButton.setOnClickListener(this);
+ double tempDurationStep = MainApp.getConfigBuilder().getPumpDescription().tempDurationStep;
+ double tempMaxDuration = MainApp.getConfigBuilder().getPumpDescription().tempMaxDuration;
+ duration = new PlusMinusEditText(view, R.id.overview_newtempbasal_duration, R.id.overview_newtempbasal_duration_plus, R.id.overview_newtempbasal_duration_minus,
+ tempDurationStep, tempDurationStep, tempMaxDuration, tempDurationStep, new DecimalFormat("0"), false);
+
+ if ((pumpDescription.tempBasalStyle & PumpDescription.PERCENT) == PumpDescription.PERCENT && (pumpDescription.tempBasalStyle & PumpDescription.ABSOLUTE) == PumpDescription.ABSOLUTE) {
+ // Both allowed
+ typeSelectorLayout.setVisibility(View.VISIBLE);
+ } else {
+ typeSelectorLayout.setVisibility(View.GONE);
+ }
+
+ if ((pumpDescription.tempBasalStyle & PumpDescription.PERCENT) == PumpDescription.PERCENT) {
+ percentRadio.setChecked(true);
+ absoluteRadio.setChecked(false);
+ percentLayout.setVisibility(View.VISIBLE);
+ absoluteLayout.setVisibility(View.GONE);
+ } else if ((pumpDescription.tempBasalStyle & PumpDescription.ABSOLUTE) == PumpDescription.ABSOLUTE) {
+ percentRadio.setChecked(false);
+ absoluteRadio.setChecked(true);
+ percentLayout.setVisibility(View.GONE);
+ absoluteLayout.setVisibility(View.VISIBLE);
+ }
+
+ view.findViewById(R.id.ok).setOnClickListener(this);
+ view.findViewById(R.id.cancel).setOnClickListener(this);
basalTypeRadioGroup.setOnCheckedChangeListener(this);
return view;
}
@@ -105,36 +119,32 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
@Override
public void onClick(View view) {
switch (view.getId()) {
- case R.id.overview_newtempbasal_okbutton:
+ case R.id.ok:
try {
- int basalPercent = 0;
- Double basalAbsolute = 0d;
+ int percent = 0;
+ Double absolute = 0d;
final boolean setAsPercent = percentRadio.isChecked();
- int durationInMinutes = 30;
- if (h10Radio.isChecked()) durationInMinutes = 60;
- if (h20Radio.isChecked()) durationInMinutes = 120;
- if (h30Radio.isChecked()) durationInMinutes = 180;
- if (h40Radio.isChecked()) durationInMinutes = 240;
+ int durationInMinutes = SafeParse.stringToInt(duration.getText());
String confirmMessage = getString(R.string.setbasalquestion);
if (setAsPercent) {
- int basalPercentInput = SafeParse.stringToDouble(basalPercentEdit.getText().toString()).intValue();
- basalPercent = MainApp.getConfigBuilder().applyBasalConstraints(basalPercentInput);
- confirmMessage += "\n" + basalPercent + "% ";
+ int basalPercentInput = SafeParse.stringToInt(basalPercent.getText());
+ percent = MainApp.getConfigBuilder().applyBasalConstraints(basalPercentInput);
+ confirmMessage += "\n" + percent + "% ";
confirmMessage += "\n" + getString(R.string.duration) + " " + durationInMinutes + "min ?";
- if (basalPercent != basalPercentInput)
+ if (percent != basalPercentInput)
confirmMessage += "\n" + getString(R.string.constraintapllied);
} else {
- Double basalAbsoluteInput = SafeParse.stringToDouble(basalAbsoluteEdit.getText().toString());
- basalAbsolute = MainApp.getConfigBuilder().applyBasalConstraints(basalAbsoluteInput);
- confirmMessage += "\n" + basalAbsolute + " U/h ";
+ Double basalAbsoluteInput = SafeParse.stringToDouble(basalAbsolute.getText());
+ absolute = MainApp.getConfigBuilder().applyBasalConstraints(basalAbsoluteInput);
+ confirmMessage += "\n" + absolute + " U/h ";
confirmMessage += "\n" + getString(R.string.duration) + " " + durationInMinutes + "min ?";
- if (basalAbsolute - basalAbsoluteInput != 0d)
+ if (absolute - basalAbsoluteInput != 0d)
confirmMessage += "\n" + getString(R.string.constraintapllied);
}
- final int finalBasalPercent = basalPercent;
- final Double finalBasal = basalAbsolute;
+ final int finalBasalPercent = percent;
+ final Double finalBasal = absolute;
final int finalDurationInMinutes = durationInMinutes;
final Context context = getContext();
@@ -178,6 +188,10 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
} catch (Exception e) {
e.printStackTrace();
}
+ break;
+ case R.id.cancel:
+ dismiss();
+ break;
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java
index 70fa2cbce0..ffbf4d9084 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java
@@ -78,26 +78,23 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
MainApp.bus().register(this);
- pumpDescription.isBolusCapable = true; // TODO: use description in setTempBasalAbsolute
- pumpDescription.bolusStep = 0.05d;
+ pumpDescription.isBolusCapable = true;
+ pumpDescription.bolusStep = 0.1d;
pumpDescription.isExtendedBolusCapable = true;
- pumpDescription.extendedBolusStep = 0.05d;
+ pumpDescription.extendedBolusStep = 0.1d;
pumpDescription.extendedBolusDurationStep = 30;
+ pumpDescription.extendedBolusMaxDuration = 8 * 60;
pumpDescription.isTempBasalCapable = true;
- pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT;
- pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
- pumpDescription.maxHighTempPercent = 200;
- pumpDescription.maxHighTempAbsolute = 0;
- pumpDescription.lowTempPercentStep = 10;
- pumpDescription.lowTempAbsoluteStep = 0;
- pumpDescription.lowTempPercentDuration = 60;
- pumpDescription.lowTempAbsoluteDuration = 60;
- pumpDescription.highTempPercentStep = 10;
- pumpDescription.highTempAbsoluteStep = 0.05d;
- pumpDescription.highTempPercentDuration = 60;
- pumpDescription.highTempAbsoluteDuration = 30;
+ pumpDescription.tempBasalStyle = PumpDescription.PERCENT;
+
+ pumpDescription.maxTempPercent = 200;
+ pumpDescription.tempPercentStep = 10;
+
+ pumpDescription.tempDurationStep = 60;
+ pumpDescription.tempMaxDuration = 24 * 60;
+
pumpDescription.isSetBasalProfileCapable = true;
pumpDescription.basalStep = 0.01d;
@@ -132,8 +129,6 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
boolean previousValue = useExtendedBoluses;
useExtendedBoluses = SP.getBoolean("danar_useextended", false);
- pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
-
if (useExtendedBoluses != previousValue && MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
sExecutionService.extendedBolusStop();
}
@@ -381,8 +376,8 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
Integer percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
if (percentRate < 100) percentRate = Round.ceilTo((double) percentRate, 10d).intValue();
else percentRate = Round.floorTo((double) percentRate, 10d).intValue();
- if (percentRate > getPumpDescription().maxHighTempPercent) {
- percentRate = getPumpDescription().maxHighTempPercent;
+ if (percentRate > getPumpDescription().maxTempPercent) {
+ percentRate = getPumpDescription().maxTempPercent;
}
// If extended in progress
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) {
@@ -499,8 +494,8 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
log.error("setTempBasalPercent: Invalid input");
return result;
}
- if (percent > getPumpDescription().maxHighTempPercent)
- percent = getPumpDescription().maxHighTempPercent;
+ if (percent > getPumpDescription().maxTempPercent)
+ percent = getPumpDescription().maxTempPercent;
if (pump.isTempBasalInProgress && pump.tempBasalPercent == percent) {
result.enacted = false;
result.success = true;
@@ -754,8 +749,8 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
public Integer applyBasalConstraints(Integer percentRate) {
Integer origPercentRate = percentRate;
if (percentRate < 0) percentRate = 0;
- if (percentRate > getPumpDescription().maxHighTempPercent)
- percentRate = getPumpDescription().maxHighTempPercent;
+ if (percentRate > getPumpDescription().maxTempPercent)
+ percentRate = getPumpDescription().maxTempPercent;
if (!Objects.equals(percentRate, origPercentRate) && Config.logConstraintsChanges && !Objects.equals(origPercentRate, Constants.basalPercentOnlyForCheckLimit))
log.debug("Limiting percent rate " + origPercentRate + "% to " + percentRate + "%");
return percentRate;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java
index 7d6e96a7e8..5df5fa238b 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java
@@ -81,26 +81,23 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
MainApp.bus().register(this);
- pumpDescription.isBolusCapable = true; // TODO: use description in setTempBasalAbsolute
+ pumpDescription.isBolusCapable = true;
pumpDescription.bolusStep = 0.1d;
pumpDescription.isExtendedBolusCapable = true;
- pumpDescription.extendedBolusStep = 0.05d;
+ pumpDescription.extendedBolusStep = 0.1d;
pumpDescription.extendedBolusDurationStep = 30;
+ pumpDescription.extendedBolusMaxDuration = 8 * 60;
pumpDescription.isTempBasalCapable = true;
- pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT;
- pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
- pumpDescription.maxHighTempPercent = 200;
- pumpDescription.maxHighTempAbsolute = 0;
- pumpDescription.lowTempPercentStep = 10;
- pumpDescription.lowTempAbsoluteStep = 0;
- pumpDescription.lowTempPercentDuration = 60;
- pumpDescription.lowTempAbsoluteDuration = 60;
- pumpDescription.highTempPercentStep = 10;
- pumpDescription.highTempAbsoluteStep = 0.05d;
- pumpDescription.highTempPercentDuration = 60;
- pumpDescription.highTempAbsoluteDuration = 30;
+ pumpDescription.tempBasalStyle = PumpDescription.PERCENT;
+
+ pumpDescription.maxTempPercent = 200;
+ pumpDescription.tempPercentStep = 10;
+
+ pumpDescription.tempDurationStep = 60;
+ pumpDescription.tempMaxDuration = 24 * 60;
+
pumpDescription.isSetBasalProfileCapable = true;
pumpDescription.basalStep = 0.01d;
@@ -135,8 +132,6 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
boolean previousValue = useExtendedBoluses;
useExtendedBoluses = SP.getBoolean("danar_useextended", false);
- pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
-
if (useExtendedBoluses != previousValue && MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
sExecutionService.extendedBolusStop();
}
@@ -502,8 +497,8 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
log.error("setTempBasalPercent: Invalid input");
return result;
}
- if (percent > getPumpDescription().maxHighTempPercent)
- percent = getPumpDescription().maxHighTempPercent;
+ if (percent > getPumpDescription().maxTempPercent)
+ percent = getPumpDescription().maxTempPercent;
if (pump.isTempBasalInProgress && pump.tempBasalPercent == percent) {
result.enacted = false;
result.success = true;
@@ -757,8 +752,8 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
public Integer applyBasalConstraints(Integer percentRate) {
Integer origPercentRate = percentRate;
if (percentRate < 0) percentRate = 0;
- if (percentRate > getPumpDescription().maxHighTempPercent)
- percentRate = getPumpDescription().maxHighTempPercent;
+ if (percentRate > getPumpDescription().maxTempPercent)
+ percentRate = getPumpDescription().maxTempPercent;
if (!Objects.equals(percentRate, origPercentRate) && Config.logConstraintsChanges && !Objects.equals(origPercentRate, Constants.basalPercentOnlyForCheckLimit))
log.debug("Limiting percent rate " + origPercentRate + "% to " + percentRate + "%");
return percentRate;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java
index d73f8051af..14f078a86a 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java
@@ -78,26 +78,23 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, ConstraintsInte
context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
MainApp.bus().register(this);
- pumpDescription.isBolusCapable = true; // TODO: use description in setTempBasalAbsolute
- pumpDescription.bolusStep = 0.05d;
+ pumpDescription.isBolusCapable = true;
+ pumpDescription.bolusStep = 0.1d;
pumpDescription.isExtendedBolusCapable = true;
pumpDescription.extendedBolusStep = 0.05d;
pumpDescription.extendedBolusDurationStep = 30;
+ pumpDescription.extendedBolusMaxDuration = 8 * 60;
pumpDescription.isTempBasalCapable = true;
- pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT;
- pumpDescription.highTempBasalStyle = PumpDescription.PERCENT;
- pumpDescription.maxHighTempPercent = 500;
- pumpDescription.maxHighTempAbsolute = 0;
- pumpDescription.lowTempPercentStep = 10;
- pumpDescription.lowTempAbsoluteStep = 0;
- pumpDescription.lowTempPercentDuration = 30;
- pumpDescription.lowTempAbsoluteDuration = 30;
- pumpDescription.highTempPercentStep = 10;
- pumpDescription.highTempAbsoluteStep = 0;
- pumpDescription.highTempPercentDuration = 15;
- pumpDescription.highTempAbsoluteDuration = 0;
+ pumpDescription.tempBasalStyle = PumpDescription.PERCENT;
+
+ pumpDescription.maxTempPercent = 200;
+ pumpDescription.tempPercentStep = 10;
+
+ pumpDescription.tempDurationStep = 60;
+ pumpDescription.tempMaxDuration = 24 * 60;
+
pumpDescription.isSetBasalProfileCapable = true;
pumpDescription.basalStep = 0.01d;
@@ -360,8 +357,8 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, ConstraintsInte
Integer percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
if (percentRate < 100) percentRate = Round.ceilTo((double) percentRate, 10d).intValue();
else percentRate = Round.floorTo((double) percentRate, 10d).intValue();
- if (percentRate > getPumpDescription().maxHighTempPercent)
- percentRate = getPumpDescription().maxHighTempPercent;
+ if (percentRate > getPumpDescription().maxTempPercent)
+ percentRate = getPumpDescription().maxTempPercent;
// Check if some temp is already in progress
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
// Correct basal already set ?
@@ -412,8 +409,8 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, ConstraintsInte
log.error("setTempBasalPercent: Invalid input");
return result;
}
- if (percent > getPumpDescription().maxHighTempPercent)
- percent = getPumpDescription().maxHighTempPercent;
+ if (percent > getPumpDescription().maxTempPercent)
+ percent = getPumpDescription().maxTempPercent;
if (pump.isTempBasalInProgress && pump.tempBasalPercent == percent) {
result.enacted = false;
result.success = true;
@@ -674,8 +671,8 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, ConstraintsInte
public Integer applyBasalConstraints(Integer percentRate) {
Integer origPercentRate = percentRate;
if (percentRate < 0) percentRate = 0;
- if (percentRate > getPumpDescription().maxHighTempPercent)
- percentRate = getPumpDescription().maxHighTempPercent;
+ if (percentRate > getPumpDescription().maxTempPercent)
+ percentRate = getPumpDescription().maxTempPercent;
if (!Objects.equals(percentRate, origPercentRate) && Config.logConstraintsChanges && !Objects.equals(origPercentRate, Constants.basalPercentOnlyForCheckLimit))
log.debug("Limiting percent rate " + origPercentRate + "% to " + percentRate + "%");
return percentRate;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java
index 9a26ab4359..be8646157a 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java
@@ -54,22 +54,19 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
pumpDescription.bolusStep = 0.1d;
pumpDescription.isExtendedBolusCapable = true;
- pumpDescription.extendedBolusStep = 0.2d;
+ pumpDescription.extendedBolusStep = 0.05d;
pumpDescription.extendedBolusDurationStep = 30;
+ pumpDescription.extendedBolusMaxDuration = 8 * 60;
pumpDescription.isTempBasalCapable = true;
- pumpDescription.lowTempBasalStyle = PumpDescription.ABSOLUTE | PumpDescription.PERCENT;
- pumpDescription.highTempBasalStyle = PumpDescription.ABSOLUTE | PumpDescription.PERCENT;
- pumpDescription.maxHighTempPercent = 600;
- pumpDescription.maxHighTempAbsolute = 10;
- pumpDescription.lowTempPercentStep = 5;
- pumpDescription.lowTempAbsoluteStep = 0.1;
- pumpDescription.lowTempPercentDuration = 30;
- pumpDescription.lowTempAbsoluteDuration = 30;
- pumpDescription.highTempPercentStep = 10;
- pumpDescription.highTempAbsoluteStep = 0.05d;
- pumpDescription.highTempPercentDuration = 30;
- pumpDescription.highTempAbsoluteDuration = 30;
+ pumpDescription.tempBasalStyle = PumpDescription.PERCENT | PumpDescription.ABSOLUTE;
+
+ pumpDescription.maxTempPercent = 500;
+ pumpDescription.tempPercentStep = 10;
+
+ pumpDescription.tempDurationStep = 30;
+ pumpDescription.tempMaxDuration = 24 * 60;
+
pumpDescription.isSetBasalProfileCapable = true;
pumpDescription.basalStep = 0.01d;
diff --git a/app/src/main/res/layout/overview_newtempbasal_dialog.xml b/app/src/main/res/layout/overview_newtempbasal_dialog.xml
index 7c7232fdb1..f4b8d90731 100644
--- a/app/src/main/res/layout/overview_newtempbasal_dialog.xml
+++ b/app/src/main/res/layout/overview_newtempbasal_dialog.xml
@@ -17,37 +17,56 @@
android:orientation="vertical"
android:padding="10dp">
-
+
+
+
+ android:layout_centerHorizontal="true"
+ android:layout_marginTop="30dp"
+ android:orientation="vertical">
+ android:text="@string/overview_newtempbasal_percent_label"
+ />
-
+
-
+
+
@@ -55,16 +74,18 @@
+ android:textAppearance="@android:style/TextAppearance.Material.Small"
+ android:textStyle="bold" />
@@ -103,6 +124,16 @@
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
+
+
@@ -110,7 +141,8 @@
android:id="@+id/overview_newtempbasal_absolute_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
+ android:layout_centerHorizontal="true"
+ android:layout_marginTop="30dp"
android:orientation="horizontal">
@@ -149,59 +181,101 @@
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_height="wrap_content">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1595884235..4e56869e16 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -619,4 +619,5 @@
Canula age
Insulin age
hours
+ Basal type