From 452ef3ed1974fe5df2ed1552ae6bcbef56c820b3 Mon Sep 17 00:00:00 2001 From: Tim Gunn <2896311+Tornado-Tim@users.noreply.github.com> Date: Thu, 9 Jan 2020 19:12:26 +1300 Subject: [PATCH] Use simpler deviation count threshold --- .../sensitivity/SensitivityOref1Plugin.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 8ec2b5c506..9f9c165c7d 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 @@ -86,7 +86,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin { List pastSensitivityArray = Arrays.asList("",""); List sensResultArray = Arrays.asList("",""); List ratioArray = Arrays.asList(0d,0d); - List deviationCatagory = Arrays.asList(96d,288d); + List deviationCategory = Arrays.asList(96d,288d); List ratioLimitArray = Arrays.asList("",""); List hoursDetection = Arrays.asList(8d,24d); @@ -133,11 +133,11 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin { if (autosensData.time > toTime - hoursDetection.get(hoursegment) * 60 * 60 * 1000L) deviationsArray.add(deviation); - if (hoursegment == 0) { - for (int i = 0; i < autosensData.extraDeviation.size(); i++) - deviationsArray.add(autosensData.extraDeviation.get(i)); - } - if (deviationsArray.size() > hoursDetection.get(hoursegment) * 60 / 5){ + + for (int i = 0; i < autosensData.extraDeviation.size(); i++) + deviationsArray.add(autosensData.extraDeviation.get(i)); + + if (deviationsArray.size() > deviationCategory.get(hoursegment)){ deviationsArray.remove(0); } @@ -163,8 +163,8 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin { ArrayList deviations = deviationsHour.get(i); if (L.isEnabled(L.AUTOSENS)) log.debug("Using most recent " + deviations.size() + " deviations"); - if (deviations.size() < deviationCatagory.get(i)) { - int pad = (int) Math.round((1 - (double) deviations.size() / deviationCatagory.get(i)) * 18); + if (deviations.size() < deviationCategory.get(i)) { + int pad = (int) Math.round((1 - (double) deviations.size() / deviationCategory.get(i)) * 18); if (L.isEnabled(L.AUTOSENS)) log.debug("Adding " + pad + " more zero deviations"); for (int d = 0; d < pad; d++) { ;