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:
Johannes Mockenhaupt 2020-04-01 16:52:14 +02:00
parent 695e23c3bd
commit 65ca6cf895
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -941,7 +941,13 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr
activeAlert.warningCode == PumpWarningCodes.TBR_CANCELLED)) {
// turn benign warnings into notifications
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) {
Notification notification = new Notification();
notification.date = DateUtil.now();