medtronic-0.11.11-SNAPSHOT

- #152 fixed double bolus problem: code is now looking for AAPS Events that happened within 2 minutes.
This commit is contained in:
Andy Rozman 2019-07-04 13:24:46 +01:00
parent be5c79f370
commit 38f13cd6db
2 changed files with 34 additions and 17 deletions

View file

@ -105,7 +105,7 @@ android {
multiDexEnabled true multiDexEnabled true
versionCode 1500 versionCode 1500
// dev_version: 2.3.1-dev // dev_version: 2.3.1-dev
version "medtronic-0.11.10-SNAPSHOT" version "medtronic-0.11.11-SNAPSHOT"
buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"' buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'

View file

@ -679,6 +679,16 @@ public class MedtronicHistoryData {
} }
/**
* findDbEntry - finds Db entries in database, while theoretically this should have same dateTime they
* don't. Entry on pump is few seconds before treatment in AAPS, and on manual boluses on pump there
* is no treatment at all. For now we look fro tratment that was from 0s - 1m59s within pump entry.
*
* @param treatment Pump Entry
* @param entriesFromHistory entries from history
*
* @return DbObject from AAPS (if found)
*/
private DbObjectBase findDbEntry(PumpHistoryEntry treatment, List<? extends DbObjectBase> entriesFromHistory) { private DbObjectBase findDbEntry(PumpHistoryEntry treatment, List<? extends DbObjectBase> entriesFromHistory) {
long proposedTime = DateTimeUtil.toMillisFromATD(treatment.atechDateTime); long proposedTime = DateTimeUtil.toMillisFromATD(treatment.atechDateTime);
@ -691,9 +701,14 @@ public class MedtronicHistoryData {
return entriesFromHistory.get(0); return entriesFromHistory.get(0);
} }
for (int sec = 0; sec <= 40; sec += 10) { for (int min = 0; min <= 2; min++) {
for (int sec = 0; sec < 60; sec += 10) {
int diff = (sec * 1000); if (min==1 && sec==50) {
sec = 59;
}
int diff = (min * 60 * 1000) + (sec * 1000);
List<DbObjectBase> outList = new ArrayList<>(); List<DbObjectBase> outList = new ArrayList<>();
@ -711,9 +726,11 @@ public class MedtronicHistoryData {
return outList.get(0); return outList.get(0);
} }
if (sec == 10 && outList.size() > 1) { if (min == 0 && sec == 10 && outList.size() > 1) {
LOG.error("Too many entries (with too small diff): (timeDiff=[sec={}],count={},list={})", if (isLogEnabled())
sec, outList.size(), gson.toJson(outList)); LOG.error("Too many entries (with too small diff): (timeDiff=[min={},sec={}],count={},list={})",
min, sec, outList.size(), gson.toJson(outList));
}
} }
} }