Better dection of a command hanging.

This commit is contained in:
Johannes Mockenhaupt 2017-11-11 16:04:33 +01:00
parent e6a29e5214
commit 0a1b8f5b14
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -305,8 +305,9 @@ public class RuffyScripter implements RuffyCommands {
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
if (now > dynamicTimeout) { if (now > dynamicTimeout) {
boolean menuRecentlyUpdated = now < menuLastUpdated + 5 * 1000; boolean menuRecentlyUpdated = now < menuLastUpdated + 5 * 1000;
boolean inMenuNotMainMenu = currentMenu != null && currentMenu.getType() != MenuType.MAIN_MENU; boolean idlingInMainMenu = getCurrentMenu().getType() == MenuType.MAIN_MENU
if (menuRecentlyUpdated || inMenuNotMainMenu) { && !getCurrentMenu().attributes().contains(MenuAttribute.BOLUS_REMAINING);
if (menuRecentlyUpdated && !idlingInMainMenu) {
// command still working (or waiting for pump to complete, e.g. bolus delivery) // command still working (or waiting for pump to complete, e.g. bolus delivery)
dynamicTimeout = now + 30 * 1000; dynamicTimeout = now + 30 * 1000;
} else { } else {