From 29cb1def50c1d568e3b691bb05296f2f8af1cf7f Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Thu, 20 Jul 2017 13:18:26 +0200 Subject: [PATCH] Fix up "Rebind ruffy if there is an exception.". Some removals, but more importantly to note that the commit set pump/command state variables volatile again. --- .../androidaps/plugins/PumpCombo/ComboFragment.java | 7 +++++-- .../androidaps/plugins/PumpCombo/ComboPlugin.java | 5 ----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java index c8564c8b62..1c10d63514 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java @@ -126,9 +126,12 @@ public class ComboFragment extends Fragment implements View.OnClickListener { if (getPlugin().lastCmd != null) { lastCmdText.setText("" + getPlugin().lastCmd); lastCmdTimeText.setText(getPlugin().lastCmdTime.toLocaleString()); - if (getPlugin().lastCmdResult != null) { - String message = getPlugin().lastCmdResult.message; + CommandResult lastCmdResult = getPlugin().lastCmdResult; + if (lastCmdResult != null) { + String message = lastCmdResult.message; lastCmdResultText.setText(message != null ? message : ""); + } else { + lastCmdResultText.setText(""); } } else { ComboFragment.this.lastCmdText.setText(""); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index 7f68b13b92..b63c2cfe5b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -8,7 +8,6 @@ import android.content.ServiceConnection; import android.graphics.Color; import android.media.RingtoneManager; import android.net.Uri; -import android.os.DeadObjectException; import android.os.IBinder; import android.os.SystemClock; import android.support.annotation.NonNull; @@ -34,7 +33,6 @@ import de.jotomo.ruffyscripter.commands.ReadPumpStateCommand; import de.jotomo.ruffyscripter.commands.SetTbrCommand; import de.jotomo.ruffyscripter.PumpState; import info.nightscout.androidaps.BuildConfig; -import info.nightscout.androidaps.Config; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.DetailedBolusInfo; @@ -120,8 +118,6 @@ public class ComboPlugin implements PluginBase, PumpInterface { new Thread(new Runnable() { @Override public void run() { -// give AAPS time to bootup, there's quit a lot going on -// SystemClock.sleep(60 * 1000); Context context = MainApp.instance().getApplicationContext(); NotificationManager mgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); int id = 1000; @@ -499,7 +495,6 @@ public class ComboPlugin implements PluginBase, PumpInterface { @Override public PumpEnactResult cancelTempBasal() { log.debug("cancelTempBasal called"); - long tbrEnd = System.currentTimeMillis(); CommandResult commandResult = runCommand(new CancelTbrCommand()); if (commandResult.enacted) { TemporaryBasal tempStop = new TemporaryBasal(commandResult.completionTime);