diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityAAPSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityAAPSPlugin.java index 4fe79aab2c..990bafa6b9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityAAPSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityAAPSPlugin.java @@ -105,14 +105,15 @@ public class SensitivityAAPSPlugin extends PluginBase implements SensitivityInte pastSensitivity += "(SITECHANGE)"; } - double deviation = autosensData.validDeviation ? autosensData.deviation : 0d; + double deviation = autosensData.deviation; //set positive deviations to zero if bg < 80 if (autosensData.bg < 80 && deviation > 0) deviation = 0; - if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L) - deviationsArray.add(deviation); + if (autosensData.validDeviation) + if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L) + deviationsArray.add(deviation); if (deviationsArray.size() > hoursForDetection * 60 / 5) deviationsArray.remove(0); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityOref0Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityOref0Plugin.java index 32210b5fb6..8910dfedb3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityOref0Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityOref0Plugin.java @@ -106,14 +106,15 @@ public class SensitivityOref0Plugin extends PluginBase implements SensitivityInt pastSensitivity += "(SITECHANGE)"; } - double deviation = autosensData.validDeviation ? autosensData.deviation : 0d; + double deviation = autosensData.deviation; //set positive deviations to zero if bg < 80 if (autosensData.bg < 80 && deviation > 0) deviation = 0; - if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L) - deviationsArray.add(deviation); + if (autosensData.validDeviation) + if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L) + deviationsArray.add(deviation); if (deviationsArray.size() > hoursForDetection * 60 / 5) deviationsArray.remove(0); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityOref1Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityOref1Plugin.java index 8941aaa2a3..5c88b02c5e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityOref1Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityOref1Plugin.java @@ -97,13 +97,14 @@ public class SensitivityOref1Plugin extends PluginBase implements SensitivityInt pastSensitivity += "(SITECHANGE)"; } - double deviation = autosensData.validDeviation ? autosensData.deviation : 0d; + double deviation = autosensData.deviation; //set positive deviations to zero if bg < 80 if (autosensData.bg < 80 && deviation > 0) deviation = 0; - deviationsArray.add(deviation); + if (autosensData.validDeviation) + deviationsArray.add(deviation); for (int i = 0; i < autosensData.extraDeviation.size(); i++) deviationsArray.add(autosensData.extraDeviation.get(i)); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityWeightedAveragePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityWeightedAveragePlugin.java index a4e19d5f76..6ac86fbc5a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityWeightedAveragePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Sensitivity/SensitivityWeightedAveragePlugin.java @@ -111,7 +111,7 @@ public class SensitivityWeightedAveragePlugin extends PluginBase implements Sens pastSensitivity += "(SITECHANGE)"; } - double deviation = autosensData.validDeviation ? autosensData.deviation : 0d; + double deviation = autosensData.deviation; //set positive deviations to zero if bg < 80 if (autosensData.bg < 80 && deviation > 0) @@ -119,7 +119,8 @@ public class SensitivityWeightedAveragePlugin extends PluginBase implements Sens //data.append(autosensData.time); long reverseWeight = (toTime - autosensData.time) / (5 * 60 * 1000L); - data.append(reverseWeight, deviation); + if (autosensData.validDeviation) + data.append(reverseWeight, deviation); //weights += reverseWeight; //weightedsum += reverseWeight * (autosensData.validDeviation ? autosensData.deviation : 0d);