Disconnect pump: cancel temp before setting new to make sure it will last as expected

This commit is contained in:
Milos Kozak 2017-08-01 17:37:32 +02:00
parent 6828e11dd9
commit a24cbfda50

View file

@ -506,6 +506,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 30);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
@ -520,6 +521,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 60);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
@ -534,6 +536,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 2 * 60);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
@ -548,6 +551,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 3 * 60);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));