ComboPlugin: fix handling benin warnings.
This change provides usable input to the check* methods. Since a dummy PumpState is returned when a command runs into a warning/alarm on the pump, the checkAndResolveTbrMismatch() reads that no TBR is active and creates a TBR-end record in the DB, which is wrong (and yes, returning a dummy PumpState rather than returning and handling null is a questionable design decision). Effectively this is only a concern when AAPS confirms a low cartridge or low battery alarm, so it's impact is small.
This commit is contained in:
parent
695e23c3bd
commit
65ca6cf895
1 changed files with 7 additions and 1 deletions
|
@ -941,7 +941,13 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr
|
||||||
activeAlert.warningCode == PumpWarningCodes.TBR_CANCELLED)) {
|
activeAlert.warningCode == PumpWarningCodes.TBR_CANCELLED)) {
|
||||||
// turn benign warnings into notifications
|
// turn benign warnings into notifications
|
||||||
notifyAboutPumpWarning(activeAlert);
|
notifyAboutPumpWarning(activeAlert);
|
||||||
ruffyScripter.confirmAlert(activeAlert.warningCode);
|
CommandResult alertConfirmationResult = ruffyScripter.confirmAlert(activeAlert.warningCode);
|
||||||
|
if (!alertConfirmationResult.success) {
|
||||||
|
return alertConfirmationResult;
|
||||||
|
}
|
||||||
|
// while the warning was active the menu data couldn't be read, only after confirmation,
|
||||||
|
// so update the var with it, so the check routines below can work on it
|
||||||
|
preCheckResult = alertConfirmationResult;
|
||||||
} else if (activeAlert.errorCode != null) {
|
} else if (activeAlert.errorCode != null) {
|
||||||
Notification notification = new Notification();
|
Notification notification = new Notification();
|
||||||
notification.date = DateUtil.now();
|
notification.date = DateUtil.now();
|
||||||
|
|
Loading…
Reference in a new issue