Fix overshoot navigating to menu (again).

This commit is contained in:
Johannes Mockenhaupt 2017-11-21 23:20:02 +01:00
parent b27ee06ebe
commit a3fe804c3d
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 10 additions and 4 deletions

View file

@ -631,6 +631,7 @@ public class RuffyScripter implements RuffyCommands {
public void navigateToMenu(MenuType desiredMenu) {
int retries = 20;
MenuType lastSeenMenu = getCurrentMenu().getType();
while (getCurrentMenu().getType() != desiredMenu) {
MenuType currentMenuType = getCurrentMenu().getType();
log.debug("Navigating to menu " + desiredMenu + ", current menu: " + currentMenuType);
@ -640,7 +641,12 @@ public class RuffyScripter implements RuffyCommands {
+ ". Check menu settings on your pump to ensure it's not hidden.");
}
pressMenuKey();
waitForScreenUpdate();
// 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.
while (getCurrentMenu().getType() == lastSeenMenu) {
waitForScreenUpdate();
}
lastSeenMenu = getCurrentMenu().getType();
}
}

View file

@ -100,9 +100,6 @@ public class ReadHistoryCommand extends BaseCommand {
}
}
scripter.returnToRootMenu();
scripter.verifyRootMenuIsDisplayed();
if (log.isDebugEnabled()) {
if (!history.bolusHistory.isEmpty()) {
log.debug("Read bolus history (" + history.bolusHistory.size() + "):");
@ -130,6 +127,9 @@ public class ReadHistoryCommand extends BaseCommand {
}
}
scripter.returnToRootMenu();
scripter.verifyRootMenuIsDisplayed();
result.success(true).history(history);
}
}