RuffyScripter: fix pump state check before running command.

This commit is contained in:
Johannes Mockenhaupt 2017-11-22 00:38:10 +01:00
parent 28b80697f9
commit bb2e885b95
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -257,10 +257,12 @@ public class RuffyScripter implements RuffyCommands {
if (cmd instanceof ReadPumpStateCommand) {
// always allowed, state is set at the end of runCommand method
activeCmd.getResult().success = true;
} else if (getCurrentMenu().getType() == MenuType.STOP && cmd.needsRunMode()) {
} else if (getCurrentMenu().getType() == MenuType.STOP) {
if (cmd.needsRunMode()) {
log.error("Requested command requires run mode, but pump is suspended");
activeCmd.getResult().success = false;
return;
}
} else if (getCurrentMenu().getType() == MenuType.WARNING_OR_ERROR && !(cmd instanceof ConfirmAlertCommand)) {
log.warn("Warning/alert active on pump, but requested command is not ConfirmAlertCommand");
activeCmd.getResult().success = false;