Merge pull request #2774 from Philoul/WearFix

WEAR Second Fix, send all raw values in mg/dl
This commit is contained in:
Milos Kozak 2020-06-26 07:56:35 +02:00 committed by GitHub
commit 196bb814f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 11 deletions

View file

@ -298,14 +298,16 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
private DataMap dataMapSingleBG(BgReading lastBG, GlucoseStatus glucoseStatus) {
String units = profileFunction.getUnits();
double lowLine = defaultValueHelper.determineLowLine();
double highLine = defaultValueHelper.determineHighLine();
double convert2MGDL = 1.0;
if (units.equals(Constants.MMOL))
convert2MGDL = Constants.MMOLL_TO_MGDL;
double lowLine = defaultValueHelper.determineLowLine()*convert2MGDL;
double highLine = defaultValueHelper.determineHighLine()*convert2MGDL;
long sgvLevel = 0L;
if (lastBG.valueToUnits(units) > highLine) {
if (lastBG.value > highLine) {
sgvLevel = 1;
} else if (lastBG.valueToUnits(units) < lowLine) {
} else if (lastBG.value < lowLine) {
sgvLevel = -1;
}
@ -323,7 +325,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
dataMap.putString("avgDelta", deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units));
}
dataMap.putLong("sgvLevel", sgvLevel);
dataMap.putDouble("sgvDouble", lastBG.valueToUnits(units));
dataMap.putDouble("sgvDouble", lastBG.value);
dataMap.putDouble("high", highLine);
dataMap.putDouble("low", lowLine);
return dataMap;
@ -539,7 +541,7 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
final String units = profileFunction.getUnits();
for (BgReading bg : predArray) {
if (bg.value < 40) continue;
predictions.add(predictionMap(bg.date, bg.valueToUnits(units), bg.getPredectionColor()));
predictions.add(predictionMap(bg.date, bg.value, bg.getPredectionColor()));
}
}
}

View file

@ -396,8 +396,8 @@ public class BgGraphBuilder {
if(singleLine) {
for (BgWatchData bgReading : bgDataList) {
if(bgReading.timestamp > start_time) {
if (bgReading.sgv >= 400) {
inRangeValues.add(new PointValue(fuzz(bgReading.timestamp), (float) 400));
if (bgReading.sgv >= 450) {
inRangeValues.add(new PointValue(fuzz(bgReading.timestamp), (float) 450));
} else if (bgReading.sgv >= highMark) {
inRangeValues.add(new PointValue(fuzz(bgReading.timestamp), (float) bgReading.sgv));
} else if (bgReading.sgv >= lowMark) {
@ -412,8 +412,8 @@ public class BgGraphBuilder {
} else {
for (BgWatchData bgReading : bgDataList) {
if (bgReading.timestamp > start_time) {
if (bgReading.sgv >= 400) {
highValues.add(new PointValue(fuzz(bgReading.timestamp), (float) 400));
if (bgReading.sgv >= 450) {
highValues.add(new PointValue(fuzz(bgReading.timestamp), (float) 450));
} else if (bgReading.sgv >= highMark) {
highValues.add(new PointValue(fuzz(bgReading.timestamp), (float) bgReading.sgv));
} else if (bgReading.sgv >= lowMark) {