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 3b211b98ad..e317432fd2 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
@@ -135,11 +135,12 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
// last connection
String minAgo = DateUtil.minAgo(plugin.getPump().lastSuccessfulCmdTime);
+ long min = (System.currentTimeMillis() - plugin.getPump().lastSuccessfulCmdTime) / 1000 / 60;
if (plugin.getPump().lastSuccessfulCmdTime + 60 * 1000 > System.currentTimeMillis()) {
lastConnectionView.setText(R.string.combo_pump_connected_now);
lastConnectionView.setTextColor(Color.WHITE);
} else if (plugin.getPump().lastSuccessfulCmdTime + 30 * 60 * 1000 < System.currentTimeMillis()) {
- lastConnectionView.setText(getString(R.string.combo_no_pump_connection, minAgo));
+ lastConnectionView.setText(getString(R.string.combo_no_pump_connection, min));
lastConnectionView.setTextColor(Color.RED);
} else if (plugin.getPump().lastCmdTime > plugin.getPump().lastSuccessfulCmdTime) {
String lastFailed = minAgo + "\n" + getString(R.string.combo_connect_attempt_failed);
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 291d990b06..80b0120867 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
@@ -627,6 +627,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
* NO history, reservoir level fields are updated, this make be done separately if desired.
*/
private synchronized CommandResult runCommand(String activity, int retries, CommandExecution commandExecution) {
+ pump.lastCmdTime = System.currentTimeMillis();
CommandResult commandResult;
try {
if (activity != null) {
@@ -659,11 +660,10 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
}
pump.lastCmdResult = commandResult;
- pump.lastCmdTime = System.currentTimeMillis();
+
if (commandResult.success) {
pump.lastSuccessfulCmdTime = pump.lastCmdTime;
}
-
} finally {
if (activity != null) {
pump.activity = null;
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4f7a18599e..683fc8c7b3 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -768,7 +768,7 @@
Stats
State
Activity
- No successful connection for %s
+ No connection for %d min
Last connect attempt failed
%s
%d%% (%d min remaining)