diff --git a/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java b/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java index 3c12acf697..b89cf3c9c1 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java @@ -440,7 +440,7 @@ public class RuffyScripter { log.debug("Releasing back key"); } - public boolean waitScreen(long timeout) + public boolean waitForScreenUpdate(long timeout) { synchronized (screenlock) { try { @@ -472,7 +472,7 @@ public class RuffyScripter { } else pressMenuKey(); - waitScreen(250); + waitForScreenUpdate(250); } return currentMenu != null && currentMenu.getType()==screen; } @@ -486,7 +486,7 @@ public class RuffyScripter { long start = System.currentTimeMillis(); pressKey(key,2000); while((currentMenu == null || currentMenu.getType()!=targetType) && start+timeout>System.currentTimeMillis()) { - waitScreen(100); + waitForScreenUpdate(100); } return currentMenu!=null && currentMenu.getType()==targetType; } diff --git a/app/src/main/java/de/jotomo/ruffyscripter/commands/GetBasalCommand.java b/app/src/main/java/de/jotomo/ruffyscripter/commands/GetBasalCommand.java index 196edeb734..09958f6bf1 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/commands/GetBasalCommand.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/commands/GetBasalCommand.java @@ -85,7 +85,7 @@ public class GetBasalCommand implements Command { // } else { // retries--; // scripter.pressMenuKey(); -// scripter.waitScreen(250); +// scripter.waitForScreenUpdate(250); // } // } else { // updateState(ERROR, 30); diff --git a/app/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java b/app/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java index 7d6a9a43f4..ec96b8e03d 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java @@ -90,7 +90,7 @@ public class SetTbrCommand implements Command { if(scripter.currentMenu.getType()== TBR_DURATION) { scripter.pressMenuKey(); - scripter.waitScreen(1000); + scripter.waitForScreenUpdate(1000); } } @@ -111,19 +111,19 @@ public class SetTbrCommand implements Command { int steps = (requestedPercentage - actualPercentage) / 10; log.debug("Adjusting basal(" + requestedPercentage + "/" + actualPercentage + ") with " + steps + " steps and " + retries + " retries left"); scripter.step(steps, (steps < 0 ? RuffyScripter.Key.DOWN : RuffyScripter.Key.UP), 500); - scripter.waitScreen(1000); + scripter.waitForScreenUpdate(1000); } } else currentPercentage=-100; - scripter.waitScreen(1000); + scripter.waitForScreenUpdate(1000); } if(currentPercentage<0 ||retries < 0) throw new CommandException().message("unable to set basalrate"); log.debug("4. checking basal in "+scripter.currentMenu); - scripter.waitScreen(1000); + scripter.waitForScreenUpdate(1000); currentPercentage= -1000; retries=10; while(currentPercentage<0 && retries>=0) { @@ -134,7 +134,7 @@ public class SetTbrCommand implements Command { currentPercentage = ((Double) percentageObj).doubleValue(); } else - scripter.waitScreen(1000); + scripter.waitForScreenUpdate(1000); } if(retries<0 ||currentPercentage!=percentage) @@ -152,7 +152,7 @@ public class SetTbrCommand implements Command { break; if (scripter.currentMenu.getType() == TBR_SET) { scripter.pressMenuKey(); - scripter.waitScreen(1000); + scripter.waitForScreenUpdate(1000); } } @@ -177,16 +177,16 @@ public class SetTbrCommand implements Command { steps--; log.debug("Adjusting duration(" + requestedDuration + "/" + actualDuration + ") with " + steps + " steps and " + retries + " retries left"); scripter.step(steps, (steps > 0 ? RuffyScripter.Key.UP : RuffyScripter.Key.DOWN), 500); - scripter.waitScreen(1000); + scripter.waitForScreenUpdate(1000); } } - scripter.waitScreen(1000); + scripter.waitForScreenUpdate(1000); } if (currentDuration < 0 || retries < 0) throw new CommandException().message("unable to set duration, requested:" + duration + ", displayed on pump: " + currentDuration); log.debug("7. checking time in " + scripter.currentMenu); - scripter.waitScreen(1000); + scripter.waitForScreenUpdate(1000); currentDuration = -1000; retries = 10; while (currentDuration < 0 && retries >= 0) { @@ -198,7 +198,7 @@ public class SetTbrCommand implements Command { currentDuration = (time.getHour() * 60) + time.getMinute(); } else - scripter.waitScreen(1000); + scripter.waitForScreenUpdate(1000); } if (retries < 0 || currentDuration != duration) throw new CommandException().message("wrong time!"); @@ -210,7 +210,7 @@ public class SetTbrCommand implements Command { { retries--; scripter.pressCheckKey(); - scripter.waitScreen(1000); + scripter.waitForScreenUpdate(1000); } if(retries<0 || scripter.currentMenu.getType()==TBR_DURATION ||scripter.currentMenu.getType()==TBR_SET) throw new CommandException().message("failed setting basal!"); @@ -225,7 +225,7 @@ public class SetTbrCommand implements Command { scripter.pressCheckKey(); retries++; canceledError = true; - scripter.waitScreen(1000); + scripter.waitForScreenUpdate(1000); } else { retries--;