Fix RuffyScripter.navigateToMenu one last time.
This commit is contained in:
parent
5bd010d8f1
commit
71b32ac078
1 changed files with 5 additions and 4 deletions
|
@ -661,19 +661,20 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void navigateToMenu(MenuType desiredMenu) {
|
public void navigateToMenu(MenuType desiredMenu) {
|
||||||
int retries = 20;
|
verifyMenuIsDisplayed(MenuType.MAIN_MENU);
|
||||||
|
int moves = 20;
|
||||||
MenuType lastSeenMenu = getCurrentMenu().getType();
|
MenuType lastSeenMenu = getCurrentMenu().getType();
|
||||||
while (lastSeenMenu != desiredMenu) {
|
while (lastSeenMenu != desiredMenu) {
|
||||||
log.debug("Navigating to menu " + desiredMenu + ", current menu: " + lastSeenMenu);
|
log.debug("Navigating to menu " + desiredMenu + ", current menu: " + lastSeenMenu);
|
||||||
retries--;
|
moves--;
|
||||||
if (retries == 0) {
|
if (moves == 0) {
|
||||||
throw new CommandException("Menu not found searching for " + desiredMenu
|
throw new CommandException("Menu not found searching for " + desiredMenu
|
||||||
+ ". Check menu settings on your pump to ensure it's not hidden.");
|
+ ". Check menu settings on your pump to ensure it's not hidden.");
|
||||||
}
|
}
|
||||||
|
MenuType next = getCurrentMenu().getType();
|
||||||
pressMenuKey();
|
pressMenuKey();
|
||||||
// sometimes the pump takes a bit longer (more than one screen refresh) to advance
|
// sometimes the pump takes a bit longer (more than one screen refresh) to advance
|
||||||
// to the next menu. wait until we actually see the change to avoid overshoots.
|
// to the next menu. wait until we actually see the change to avoid overshoots.
|
||||||
MenuType next = getCurrentMenu().getType();
|
|
||||||
while (next == lastSeenMenu) {
|
while (next == lastSeenMenu) {
|
||||||
waitForScreenUpdate();
|
waitForScreenUpdate();
|
||||||
next = getCurrentMenu().getType();
|
next = getCurrentMenu().getType();
|
||||||
|
|
Loading…
Reference in a new issue