Merge pull request #245 from AdrianLxM/xdripstatusline
Workaround for DanaR truncation
This commit is contained in:
commit
0347ebaffb
1 changed files with 3 additions and 1 deletions
|
@ -531,7 +531,9 @@ public class ExecutionService extends Service {
|
||||||
private double[] buildDanaRProfileRecord(NSProfile nsProfile) {
|
private double[] buildDanaRProfileRecord(NSProfile nsProfile) {
|
||||||
double[] record = new double[24];
|
double[] record = new double[24];
|
||||||
for (Integer hour = 0; hour < 24; hour++) {
|
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)
|
if (Config.logDanaMessageDetail)
|
||||||
log.debug("NS basal value for " + hour + ":00 is " + value);
|
log.debug("NS basal value for " + hour + ":00 is " + value);
|
||||||
record[hour] = value;
|
record[hour] = value;
|
||||||
|
|
Loading…
Reference in a new issue