BolusCommand: cancel earlier if requested.

This commit is contained in:
Johannes Mockenhaupt 2017-10-31 02:13:13 +01:00
parent 50cbcaba52
commit 39b89df484
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -55,6 +55,11 @@ public class BolusCommand extends BaseCommand {
@Override @Override
public void execute() { public void execute() {
try { try {
if (cancelRequested) {
bolusProgressReporter.report(STOPPED, 0, 0);
result.success = true;
return;
}
bolusProgressReporter.report(PROGRAMMING, 0, 0); bolusProgressReporter.report(PROGRAMMING, 0, 0);
enterBolusMenu(); enterBolusMenu();
inputBolusAmount(); inputBolusAmount();
@ -191,6 +196,7 @@ public class BolusCommand extends BaseCommand {
} }
public void requestCancellation() { public void requestCancellation() {
log.debug("Bolus cancellation requested");
cancelRequested = true; cancelRequested = true;
bolusProgressReporter.report(STOPPING, 0, 0); bolusProgressReporter.report(STOPPING, 0, 0);
} }