From 65ca6cf89523399305bfd5cc12025007bdba08a5 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 1 Apr 2020 16:52:14 +0200 Subject: [PATCH 1/3] 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(); From e0ac0805832ba137ddce6c4add64ae1b8a4224c7 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Fri, 10 Apr 2020 15:10:01 +0200 Subject: [PATCH 2/3] RuffyScripter: adjust some log levels. --- .../plugins/pump/combo/ruffyscripter/RuffyScripter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java index b36a5f2a71..d2ac2e245b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/RuffyScripter.java @@ -160,7 +160,7 @@ public class RuffyScripter implements RuffyCommands { } if (!boundSucceeded) { - log.error("No connection to ruffy. Pump control unavailable."); + log.info("No connection to ruffy. Pump control unavailable."); } } @@ -262,7 +262,7 @@ public class RuffyScripter implements RuffyCommands { long cmdEndTime = System.currentTimeMillis(); log.debug("Executing " + cmd + " took " + (cmdEndTime - cmdStartTime) + "ms"); } catch (CommandException e) { - log.error("CommandException running command", e); + log.info("CommandException running command", e); cmd.getResult().success = false; } catch (Exception e) { log.error("Unexpected exception running cmd", e); From 04b324fd193cdbe98f156a5d24345db321130a98 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 1 Apr 2020 16:47:36 +0200 Subject: [PATCH 3/3] Android notification: make longer text readable. If text is longer than one line, this change allows expanding the notification to make the entire text readable. --- .../plugins/general/overview/notifications/NotificationStore.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt index a14f33e33c..fd1ca3fce1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt @@ -116,6 +116,7 @@ class NotificationStore @Inject constructor( .setSmallIcon(smallIcon) .setLargeIcon(largeIcon) .setContentText(n.text) + .setStyle(NotificationCompat.BigTextStyle().bigText(n.text)) .setPriority(NotificationCompat.PRIORITY_MAX) .setDeleteIntent(deleteIntent(n.id)) if (n.level == Notification.URGENT) {