diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java index 2e23d2a955..11d1bad3d9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java @@ -32,6 +32,7 @@ import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage; +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil; import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil; import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil; import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder; @@ -613,6 +614,8 @@ public class MedtronicHistoryData { return; } + filterOutNonInsulinEntries(entriesFromHistory); + if (doubleBolusDebug) LOG.debug("DoubleBolusDebug: List (after filter): {}, FromDb={}", gson.toJson(entryList), gsonCore.toJson(entriesFromHistory)); @@ -640,6 +643,23 @@ public class MedtronicHistoryData { } + private void filterOutNonInsulinEntries(List entriesFromHistory) { + // when we try to pair PumpHistory with AAPS treatments, we need to ignore all non-insulin entries + List removeList = new ArrayList<>(); + + for (DbObjectBase dbObjectBase : entriesFromHistory) { + + Treatment treatment = (Treatment)dbObjectBase; + + if (RileyLinkUtil.isSame(treatment.insulin, 0d)) { + removeList.add(dbObjectBase); + } + } + + entriesFromHistory.removeAll(removeList); + } + + private void processTBREntries(List entryList) { Collections.reverse(entryList); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e03b30b2b9..f34ec9c784 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1542,7 +1542,7 @@ RileyLink Address invalid. Pump type detected is not the same as configured type. - Basal profiles are not enabled on pump. + Basal profiles/patterns setting is not enabled on pump. Enable it on the pump. Basal profile set on pump is incorrect (must be STD). Wrong TBR type set on pump (must be Absolute). Wrong Max Bolus set on Pump (must be %1$.2f).