diff --git a/app/src/main/assets/OpenAPSMA/determine-basal.js b/app/src/main/assets/OpenAPSMA/determine-basal.js index 1492caf3de..4c5a00fade 100644 --- a/app/src/main/assets/OpenAPSMA/determine-basal.js +++ b/app/src/main/assets/OpenAPSMA/determine-basal.js @@ -22,7 +22,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ } var bg = glucose_status.glucose; - if (bg < 30) { //Dexcom is in ??? mode or calibrating, do nothing. Asked @benwest for raw data in iter_glucose + if (bg < 38) { //Dexcom is in ??? mode or calibrating, do nothing. Asked @benwest for raw data in iter_glucose rT.error = "CGM is calibrating or in ??? state"; return rT; } diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java index b32592b594..4717f6e237 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java +++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java @@ -159,6 +159,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { QueryBuilder queryBuilder = daoBgReadings.queryBuilder(); queryBuilder.orderBy("timeIndex", false); queryBuilder.limit(1L); + queryBuilder.where().gt("value", 38); PreparedQuery preparedQuery = queryBuilder.prepare(); bgList = daoBgReadings.query(preparedQuery); @@ -196,6 +197,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { queryBuilder.orderBy("timeIndex", true); Where where = queryBuilder.where(); where.ge("timeIndex", mills); + queryBuilder.where().gt("value", 38); PreparedQuery preparedQuery = queryBuilder.prepare(); bgReadings = daoBgreadings.query(preparedQuery); return bgReadings; @@ -281,6 +283,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { List bgReadings; QueryBuilder queryBuilder = daoBgreadings.queryBuilder(); queryBuilder.orderBy("timeIndex", false); + queryBuilder.where().gt("value", 38); queryBuilder.limit(4l); PreparedQuery preparedQuery = queryBuilder.prepare(); bgReadings = daoBgreadings.query(preparedQuery); @@ -300,13 +303,13 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { BgReading last = bgReadings.get(sizeRecords - 3); BgReading last1 = bgReadings.get(sizeRecords - 2); BgReading last2 = bgReadings.get(sizeRecords - 1); - if (last2.value > 30) { + if (last2.value > 38) { minutes = (now.timeIndex - last2.timeIndex)/(60d*1000); change = now.value - last2.value; - } else if (last1.value > 30) { + } else if (last1.value > 38) { minutes = (now.timeIndex - last1.timeIndex)/(60d*1000);; change = now.value - last1.value; - } else if (last.value > 30) { + } else if (last.value > 38) { minutes = (now.timeIndex - last.timeIndex)/(60d*1000); change = now.value - last.value; } else {