Bolusing: make cancellation during 'confirmation wait window' robust.
This commit is contained in:
parent
b9f12aeddb
commit
7e7b11ba14
1 changed files with 10 additions and 2 deletions
|
@ -19,7 +19,6 @@ import de.jotomo.ruffyscripter.RuffyScripter;
|
||||||
|
|
||||||
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.DELIVERED;
|
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.DELIVERED;
|
||||||
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.DELIVERING;
|
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.DELIVERING;
|
||||||
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.FINISHED;
|
|
||||||
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.PROGRAMMING;
|
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.PROGRAMMING;
|
||||||
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.STOPPED;
|
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.STOPPED;
|
||||||
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.STOPPING;
|
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.STOPPING;
|
||||||
|
@ -128,6 +127,15 @@ public class BolusCommand extends BaseCommand {
|
||||||
}
|
}
|
||||||
Integer warningCode = warningOrErrorCode.warningCode;
|
Integer warningCode = warningOrErrorCode.warningCode;
|
||||||
if (Objects.equals(warningCode, PumpWarningCodes.BOLUS_CANCELLED)) {
|
if (Objects.equals(warningCode, PumpWarningCodes.BOLUS_CANCELLED)) {
|
||||||
|
// wait until cancellation thread releases the up button, otherwise we won't
|
||||||
|
// be able to confirm anything
|
||||||
|
if (cancellationThread != null) {
|
||||||
|
try {
|
||||||
|
cancellationThread.join(3500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
scripter.confirmAlert(PumpWarningCodes.BOLUS_CANCELLED, 2000);
|
scripter.confirmAlert(PumpWarningCodes.BOLUS_CANCELLED, 2000);
|
||||||
bolusProgressReporter.report(STOPPED, 0, 0);
|
bolusProgressReporter.report(STOPPED, 0, 0);
|
||||||
log.debug("Stage 3: confirmed BOLUS CANCELLED after cancelling bolus during delivery");
|
log.debug("Stage 3: confirmed BOLUS CANCELLED after cancelling bolus during delivery");
|
||||||
|
|
Loading…
Reference in a new issue