From 65ca6cf89523399305bfd5cc12025007bdba08a5 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 1 Apr 2020 16:52:14 +0200 Subject: [PATCH] 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. --- .../androidaps/plugins/pump/combo/ComboPlugin.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java index 5521396b6b..2a63947f5a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java @@ -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();