Add Noise to be used later when needed

This commit is contained in:
Tim Gunn 2019-11-29 20:23:30 +13:00
parent 1dbc4a7aa2
commit 724c1edfd5

View file

@ -21,6 +21,7 @@ import info.nightscout.androidaps.utils.Round;
public class GlucoseStatus { public class GlucoseStatus {
private static Logger log = LoggerFactory.getLogger(GlucoseStatus.class); private static Logger log = LoggerFactory.getLogger(GlucoseStatus.class);
public double glucose = 0d; public double glucose = 0d;
public double noise = 0d;
public double delta = 0d; public double delta = 0d;
public double avgdelta = 0d; public double avgdelta = 0d;
public double short_avgdelta = 0d; public double short_avgdelta = 0d;
@ -30,6 +31,7 @@ public class GlucoseStatus {
public String log() { public String log() {
return "Glucose: " + DecimalFormatter.to0Decimal(glucose) + " mg/dl " + return "Glucose: " + DecimalFormatter.to0Decimal(glucose) + " mg/dl " +
"Noise: " + DecimalFormatter.to0Decimal(noise) + " " +
"Delta: " + DecimalFormatter.to0Decimal(delta) + " mg/dl" + "Delta: " + DecimalFormatter.to0Decimal(delta) + " mg/dl" +
"Short avg. delta: " + " " + DecimalFormatter.to2Decimal(short_avgdelta) + " mg/dl " + "Short avg. delta: " + " " + DecimalFormatter.to2Decimal(short_avgdelta) + " mg/dl " +
"Long avg. delta: " + DecimalFormatter.to2Decimal(long_avgdelta) + " mg/dl"; "Long avg. delta: " + DecimalFormatter.to2Decimal(long_avgdelta) + " mg/dl";
@ -40,6 +42,7 @@ public class GlucoseStatus {
public GlucoseStatus round() { public GlucoseStatus round() {
this.glucose = Round.roundTo(this.glucose, 0.1); this.glucose = Round.roundTo(this.glucose, 0.1);
this.noise = Round.roundTo(this.noise, 0.1);
this.delta = Round.roundTo(this.delta, 0.01); this.delta = Round.roundTo(this.delta, 0.01);
this.avgdelta = Round.roundTo(this.avgdelta, 0.01); this.avgdelta = Round.roundTo(this.avgdelta, 0.01);
this.short_avgdelta = Round.roundTo(this.short_avgdelta, 0.01); this.short_avgdelta = Round.roundTo(this.short_avgdelta, 0.01);
@ -89,6 +92,7 @@ public class GlucoseStatus {
if (sizeRecords == 1) { if (sizeRecords == 1) {
GlucoseStatus status = new GlucoseStatus(); GlucoseStatus status = new GlucoseStatus();
status.glucose = now.value; status.glucose = now.value;
status.noise = 0d;
status.short_avgdelta = 0d; status.short_avgdelta = 0d;
status.delta = 0d; status.delta = 0d;
status.long_avgdelta = 0d; status.long_avgdelta = 0d;
@ -148,6 +152,7 @@ public class GlucoseStatus {
GlucoseStatus status = new GlucoseStatus(); GlucoseStatus status = new GlucoseStatus();
status.glucose = now.value; status.glucose = now.value;
status.date = now_date; status.date = now_date;
status.noise = 0d; //for now set to nothing as not all CGMs report noise
status.short_avgdelta = average(short_deltas); status.short_avgdelta = average(short_deltas);