Fail on attempts to cancel non-running TBR.
Until we know this would be benign. We still return 'enacted=true', so AAPS can mark the TBR as finished to recover from this error state.
This commit is contained in:
parent
a1564d5bb7
commit
bf179cd751
|
@ -26,18 +26,16 @@ public class CancelTbrCommand implements Command {
|
||||||
try {
|
try {
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.MAIN_MENU);
|
scripter.verifyMenuIsDisplayed(MenuType.MAIN_MENU);
|
||||||
if (!initialPumpState.tbrActive) {
|
if (!initialPumpState.tbrActive) {
|
||||||
// this is likely a relatively harmless error like AAPS trying to cancel a TBR
|
log.warn("No TBR active to cancel");
|
||||||
// that has run out in the last minute or so, but for debugging lets raise an error
|
return new CommandResult()
|
||||||
// to make sure we can inspect this situation.
|
// Raise a warning about this, until we know it's safe to ignore.
|
||||||
// Set enacted=true, so I record is created and AAPS stops thinking a TBR still
|
.success(false)
|
||||||
// running and trying again to cancel it.
|
// Technically, nothing was enacted, but AAPS needs this to recover
|
||||||
return new CommandResult().success(false).enacted(true).message("No TBR active");
|
// when there was an issue and AAPS thinks a TBR is still active,
|
||||||
/*
|
// so the ComboPlugin can create a TempporaryBasel to mark the TBR
|
||||||
.success(true)
|
// as finished to get in sync with the pump state.
|
||||||
.enacted(true) // technically, nothing was enacted, but AAPS needs this to recover
|
.enacted(true)
|
||||||
// when there was an issue and AAPS thinks a TBR is still active
|
|
||||||
.message("No TBR active");
|
.message("No TBR active");
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
log.debug("Cancelling active TBR of " + initialPumpState.tbrPercent
|
log.debug("Cancelling active TBR of " + initialPumpState.tbrPercent
|
||||||
+ "% with " + initialPumpState.tbrRemainingDuration + " min remaining");
|
+ "% with " + initialPumpState.tbrRemainingDuration + " min remaining");
|
||||||
|
|
Loading…
Reference in a new issue