reset autosens on site change (AAPS,WA)
This commit is contained in:
parent
8237456030
commit
c139942981
2 changed files with 19 additions and 0 deletions
|
@ -14,6 +14,7 @@ import info.nightscout.androidaps.Config;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.db.CareportalEvent;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
|
@ -80,6 +81,8 @@ public class SensitivityAAPSPlugin extends PluginBase implements SensitivityInte
|
|||
}
|
||||
|
||||
|
||||
List<CareportalEvent> siteChanges = MainApp.getDbHelper().getCareportalEventsFromTime(fromTime, CareportalEvent.SITECHANGE, true);
|
||||
|
||||
List<Double> deviationsArray = new ArrayList<>();
|
||||
String pastSensitivity = "";
|
||||
int index = 0;
|
||||
|
@ -96,6 +99,12 @@ public class SensitivityAAPSPlugin extends PluginBase implements SensitivityInte
|
|||
continue;
|
||||
}
|
||||
|
||||
// reset deviations after site change
|
||||
if (CareportalEvent.isEvent5minBack(siteChanges, autosensData.time)) {
|
||||
deviationsArray.clear();
|
||||
pastSensitivity += "(SITECHANGE)";
|
||||
}
|
||||
|
||||
if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L)
|
||||
deviationsArray.add(autosensData.validDeviation ? autosensData.deviation : 0d);
|
||||
if (deviationsArray.size() > hoursForDetection * 60 / 5)
|
||||
|
|
|
@ -6,11 +6,13 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
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;
|
||||
import info.nightscout.androidaps.db.CareportalEvent;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
|
@ -79,6 +81,8 @@ public class SensitivityWeightedAveragePlugin extends PluginBase implements Sens
|
|||
return new AutosensResult();
|
||||
}
|
||||
|
||||
List<CareportalEvent> siteChanges = MainApp.getDbHelper().getCareportalEventsFromTime(fromTime, CareportalEvent.SITECHANGE, true);
|
||||
|
||||
String pastSensitivity = "";
|
||||
int index = 0;
|
||||
LongSparseArray<Double> data = new LongSparseArray<>();
|
||||
|
@ -101,6 +105,12 @@ public class SensitivityWeightedAveragePlugin extends PluginBase implements Sens
|
|||
continue;
|
||||
}
|
||||
|
||||
// reset deviations after site change
|
||||
if (CareportalEvent.isEvent5minBack(siteChanges, autosensData.time)) {
|
||||
data.clear();
|
||||
pastSensitivity += "(SITECHANGE)";
|
||||
}
|
||||
|
||||
//data.append(autosensData.time);
|
||||
long reverseWeight = (toTime - autosensData.time) / (5 * 60 * 1000L);
|
||||
data.append(reverseWeight, autosensData.validDeviation ? autosensData.deviation : 0d);
|
||||
|
|
Loading…
Reference in a new issue