Don't loop with readings coming from non-active BG source.
This commit is contained in:
parent
6abad56b1f
commit
7a331e0c94
1 changed files with 13 additions and 10 deletions
|
@ -20,6 +20,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
|
@ -32,7 +33,6 @@ import info.nightscout.androidaps.db.BgReading;
|
||||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||||
import info.nightscout.androidaps.events.Event;
|
import info.nightscout.androidaps.events.Event;
|
||||||
import info.nightscout.androidaps.events.EventNewBG;
|
import info.nightscout.androidaps.events.EventNewBG;
|
||||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
|
||||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||||
import info.nightscout.androidaps.interfaces.Constraint;
|
import info.nightscout.androidaps.interfaces.Constraint;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
@ -57,11 +57,9 @@ import info.nightscout.utils.SP;
|
||||||
public class LoopPlugin extends PluginBase {
|
public class LoopPlugin extends PluginBase {
|
||||||
private static Logger log = LoggerFactory.getLogger(LoopPlugin.class);
|
private static Logger log = LoggerFactory.getLogger(LoopPlugin.class);
|
||||||
|
|
||||||
public static final String CHANNEL_ID = "AndroidAPS-Openloop";
|
private static final String CHANNEL_ID = "AndroidAPS-Openloop";
|
||||||
|
private long lastBgTriggeredRun = 0;
|
||||||
long lastBgTriggeredRun = 0;
|
private static LoopPlugin loopPlugin;
|
||||||
|
|
||||||
protected static LoopPlugin loopPlugin;
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static LoopPlugin getPlugin() {
|
public static LoopPlugin getPlugin() {
|
||||||
|
@ -157,15 +155,20 @@ public class LoopPlugin extends PluginBase {
|
||||||
// already looped with that value
|
// already looped with that value
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
PluginBase bgSource = (PluginBase) ConfigBuilderPlugin.getActiveBgSource();
|
||||||
|
if (bgSource == null) {
|
||||||
|
// no BG source active
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(bgReading.sourcePlugin, bgSource.pluginDescription.getUserfriendlyName())) {
|
||||||
|
// reading not from active BG source (likely coming in from NS)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
lastBgTriggeredRun = bgReading.date;
|
lastBgTriggeredRun = bgReading.date;
|
||||||
invoke("AutosenseCalculation for " + bgReading, true);
|
invoke("AutosenseCalculation for " + bgReading, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long suspendedTo() {
|
|
||||||
return loopSuspendedTill;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void suspendTo(long endTime) {
|
public void suspendTo(long endTime) {
|
||||||
loopSuspendedTill = endTime;
|
loopSuspendedTill = endTime;
|
||||||
isSuperBolus = false;
|
isSuperBolus = false;
|
||||||
|
|
Loading…
Reference in a new issue