diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ruffyscripter/RuffyScripter.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ruffyscripter/RuffyScripter.java index 8f97677dab..8b923d51ff 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ruffyscripter/RuffyScripter.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ruffyscripter/RuffyScripter.java @@ -56,6 +56,8 @@ public class RuffyScripter implements RuffyCommands { @Nullable private volatile Menu currentMenu; private volatile long menuLastUpdated = 0; + private volatile boolean unparsableMenuEncountered; + private String previousCommand = ""; private volatile Command activeCmd = null; @@ -125,6 +127,7 @@ public class RuffyScripter implements RuffyCommands { @Override public void rtDisplayHandleNoMenu() throws RemoteException { log.warn("rtDisplayHandleNoMenu callback invoked"); + unparsableMenuEncountered = true; } }; @@ -323,6 +326,12 @@ public class RuffyScripter implements RuffyCommands { break; } + if (unparsableMenuEncountered) { + log.error("UnparsableMenuEncountered flagged, aborting command"); + cmdThread.interrupt(); + activeCmd.getResult().success = false; + } + log.trace("Waiting for running command to complete"); SystemClock.sleep(500); }