From 3869b143c419deed93e2e17639f3770abd74edb0 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Tue, 16 May 2017 16:29:30 +0200 Subject: [PATCH] Workaround for DanaR truncation --- .../plugins/PumpDanaR/Services/ExecutionService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/Services/ExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/Services/ExecutionService.java index ffd16fefdf..3916b25bf9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/Services/ExecutionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/Services/ExecutionService.java @@ -531,7 +531,9 @@ public class ExecutionService extends Service { private double[] buildDanaRProfileRecord(NSProfile nsProfile) { double[] record = new double[24]; for (Integer hour = 0; hour < 24; hour++) { - double value = nsProfile.getBasal(hour * 60 * 60); + //Some values get truncated to the next lower one. + // -> round them to two decimals and make sure we are a small delta larger (that will get truncated) + double value = Math.round(100d * nsProfile.getBasal(hour * 60 * 60))/100d + 0.00001; if (Config.logDanaMessageDetail) log.debug("NS basal value for " + hour + ":00 is " + value); record[hour] = value;