fix sensitivy
This commit is contained in:
parent
ebf56d0032
commit
c75bb0e453
|
@ -31,19 +31,16 @@ public class Config {
|
||||||
|
|
||||||
public static final boolean detailedLog = true;
|
public static final boolean detailedLog = true;
|
||||||
public static final boolean logFunctionCalls = true;
|
public static final boolean logFunctionCalls = true;
|
||||||
public static final boolean logIncommingBG = true;
|
|
||||||
public static final boolean logIncommingData = true;
|
public static final boolean logIncommingData = true;
|
||||||
public static final boolean logAPSResult = true;
|
public static final boolean logAPSResult = true;
|
||||||
public static final boolean logPumpComm = true;
|
public static final boolean logPumpComm = true;
|
||||||
public static final boolean logPrefsChange = true;
|
public static final boolean logPrefsChange = true;
|
||||||
public static final boolean logConfigBuilder = true;
|
public static final boolean logConfigBuilder = true;
|
||||||
public static final boolean logConstraintsChanges = true;
|
public static final boolean logConstraintsChanges = true;
|
||||||
public static final boolean logTempBasalsCut = true;
|
|
||||||
public static final boolean logNSUpload = true;
|
public static final boolean logNSUpload = true;
|
||||||
public static final boolean logPumpActions = true;
|
public static final boolean logPumpActions = true;
|
||||||
public static final boolean logSMSComm = true;
|
|
||||||
public static final boolean logCongigBuilderActions = true;
|
public static final boolean logCongigBuilderActions = true;
|
||||||
public static final boolean logAutosensData = false;
|
public static final boolean logAutosensData = true;
|
||||||
|
|
||||||
// DanaR specific
|
// DanaR specific
|
||||||
public static final boolean logDanaBTComm = true;
|
public static final boolean logDanaBTComm = true;
|
||||||
|
|
|
@ -416,6 +416,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
||||||
autosensData.nonEqualDeviation = true;
|
autosensData.nonEqualDeviation = true;
|
||||||
} else {
|
} else {
|
||||||
autosensData.pastSensitivity += "-";
|
autosensData.pastSensitivity += "-";
|
||||||
|
autosensData.nonEqualDeviation = true;
|
||||||
}
|
}
|
||||||
autosensData.nonCarbsDeviation = true;
|
autosensData.nonCarbsDeviation = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.support.v4.util.LongSparseArray;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.lang.reflect.Array;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -107,8 +108,6 @@ public class SensitivityAAPSPlugin implements PluginBase, SensitivityInterface{
|
||||||
if (age.equals(MainApp.sResources.getString(R.string.key_child))) defaultHours = 4;
|
if (age.equals(MainApp.sResources.getString(R.string.key_child))) defaultHours = 4;
|
||||||
int hoursForDetection = SP.getInt(R.string.key_openapsama_autosens_period, defaultHours);
|
int hoursForDetection = SP.getInt(R.string.key_openapsama_autosens_period, defaultHours);
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
|
||||||
|
|
||||||
if (autosensDataTable == null || autosensDataTable.size() < 4) {
|
if (autosensDataTable == null || autosensDataTable.size() < 4) {
|
||||||
log.debug("No autosens data available");
|
log.debug("No autosens data available");
|
||||||
return new AutosensResult();
|
return new AutosensResult();
|
||||||
|
@ -137,7 +136,7 @@ public class SensitivityAAPSPlugin implements PluginBase, SensitivityInterface{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autosensData.time > now - hoursForDetection * 60 * 60 * 1000L)
|
if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L)
|
||||||
deviationsArray.add(autosensData.nonEqualDeviation ? autosensData.deviation : 0d);
|
deviationsArray.add(autosensData.nonEqualDeviation ? autosensData.deviation : 0d);
|
||||||
if (deviationsArray.size() > hoursForDetection * 60 / 5)
|
if (deviationsArray.size() > hoursForDetection * 60 / 5)
|
||||||
deviationsArray.remove(0);
|
deviationsArray.remove(0);
|
||||||
|
@ -187,7 +186,8 @@ public class SensitivityAAPSPlugin implements PluginBase, SensitivityInterface{
|
||||||
log.debug(ratioLimit);
|
log.debug(ratioLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.error("Sensitivity to: " + new Date(toTime).toLocaleString() + " percentile: " + percentile);
|
log.debug("Sensitivity to: " + new Date(toTime).toLocaleString() + " percentile: " + percentile + " ratio: " + ratio);
|
||||||
|
log.debug("Sensitivity to: deviations " + Arrays.toString(deviations));
|
||||||
|
|
||||||
AutosensResult output = new AutosensResult();
|
AutosensResult output = new AutosensResult();
|
||||||
output.ratio = Round.roundTo(ratio, 0.01);
|
output.ratio = Round.roundTo(ratio, 0.01);
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class SensitivityOref0Plugin implements PluginBase, SensitivityInterface
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autosensData.time > now - hoursForDetection * 60 * 60 * 1000L)
|
if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L)
|
||||||
deviationsArray.add(autosensData.nonEqualDeviation ? autosensData.deviation : 0d);
|
deviationsArray.add(autosensData.nonEqualDeviation ? autosensData.deviation : 0d);
|
||||||
if (deviationsArray.size() > hoursForDetection * 60 / 5)
|
if (deviationsArray.size() > hoursForDetection * 60 / 5)
|
||||||
deviationsArray.remove(0);
|
deviationsArray.remove(0);
|
||||||
|
|
Loading…
Reference in a new issue