Sensitivity logging optional
This commit is contained in:
parent
881a745e32
commit
dbf5a5e577
|
@ -5,11 +5,9 @@ import android.support.v4.util.LongSparseArray;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
|
@ -32,7 +30,7 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
|
|||
private boolean fragmentEnabled = true;
|
||||
private boolean fragmentVisible = false;
|
||||
|
||||
static SensitivityWeightedAveragePlugin plugin = null;
|
||||
private static SensitivityWeightedAveragePlugin plugin = null;
|
||||
|
||||
public static SensitivityWeightedAveragePlugin getPlugin() {
|
||||
if (plugin == null)
|
||||
|
@ -108,12 +106,14 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
|
|||
int hoursForDetection = SP.getInt(R.string.key_openapsama_autosens_period, defaultHours);
|
||||
|
||||
if (autosensDataTable == null || autosensDataTable.size() < 4) {
|
||||
if (Config.logAutosensData)
|
||||
log.debug("No autosens data available");
|
||||
return new AutosensResult();
|
||||
}
|
||||
|
||||
AutosensData current = IobCobCalculatorPlugin.getAutosensData(toTime);
|
||||
if (current == null) {
|
||||
if (Config.logAutosensData)
|
||||
log.debug("No autosens data available");
|
||||
return new AutosensResult();
|
||||
}
|
||||
|
@ -181,8 +181,9 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
|
|||
double sens = profile.getIsf();
|
||||
|
||||
String ratioLimit = "";
|
||||
String sensResult = "";
|
||||
String sensResult;
|
||||
|
||||
if (Config.logAutosensData)
|
||||
log.debug("Records: " + index + " " + pastSensitivity);
|
||||
|
||||
double average = weightedsum / weights;
|
||||
|
@ -197,6 +198,7 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
|
|||
sensResult = "Sensitivity normal";
|
||||
}
|
||||
|
||||
if (Config.logAutosensData)
|
||||
log.debug(sensResult);
|
||||
|
||||
double rawRatio = ratio;
|
||||
|
@ -205,9 +207,11 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
|
|||
|
||||
if (ratio != rawRatio) {
|
||||
ratioLimit = "Ratio limited from " + rawRatio + " to " + ratio;
|
||||
if (Config.logAutosensData)
|
||||
log.debug(ratioLimit);
|
||||
}
|
||||
|
||||
if (Config.logAutosensData)
|
||||
log.debug("Sensitivity to: " + new Date(toTime).toLocaleString() + " weightedaverage: " + average + " ratio: " + ratio);
|
||||
|
||||
AutosensResult output = new AutosensResult();
|
||||
|
|
Loading…
Reference in a new issue