From 17d5945a91c4a771773c97fb2c64090c84753272 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sat, 17 Mar 2018 19:46:15 +0100 Subject: [PATCH] Don't run loop for back-filled BG either. --- .../info/nightscout/androidaps/plugins/Loop/LoopPlugin.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java index ea5fdd5201..73c0fa856a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java @@ -23,6 +23,7 @@ import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; +import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventTreatmentChange; import info.nightscout.androidaps.interfaces.APSInterface; @@ -163,7 +164,9 @@ public class LoopPlugin implements PluginBase { return; EventNewBG bgEv = (EventNewBG) ev.cause; - if (bgEv.isNew && bgEv.isFromActiveBgSource) { + BgReading bg = bgEv.bgReading; + if (bgEv.isNew && bgEv.isFromActiveBgSource + && bg != null && bg.date + 9 * 60 * 1000 > System.currentTimeMillis()) { invoke("New BG", true); } }