Skip to content

Commit

Permalink
added some missing sbx.scaleBg's
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncalabrese committed Jul 1, 2015
1 parent 61f580b commit 1cfdc03
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/plugins/ar2.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function init() {

var rawbgProp = sbx.properties.rawbg;
if (rawbgProp) {
lines.push(['Raw BG:', rawbgProp.value, sbx.unitsLabel, rawbgProp.noiseLabel].join(' '));
lines.push(['Raw BG:', sbx.scaleBg(rawbgProp.value), sbx.unitsLabel, rawbgProp.noiseLabel].join(' '));
}

lines.push([usingRaw ? 'Raw BG' : 'BG', '15m:', sbx.scaleBg(predicted[2]), sbx.unitsLabel].join(' '));
Expand Down
7 changes: 3 additions & 4 deletions lib/plugins/rawbg.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function init() {

var options = prop && prop.sgv && rawbg.showRawBGs(prop.sgv.y, prop.sgv.noise, prop.cal, sbx) ? {
hide: !prop || !prop.value
, value: prop.value
, value: sbx.scaleBg(prop.value)
, label: prop.noiseLabel
} : {
hide: true
Expand All @@ -48,18 +48,17 @@ function init() {
var raw = 0
, unfiltered = parseInt(sgv.unfiltered) || 0
, filtered = parseInt(sgv.filtered) || 0
, sgv = sgv.y
, scale = parseFloat(cal.scale) || 0
, intercept = parseFloat(cal.intercept) || 0
, slope = parseFloat(cal.slope) || 0;


if (slope == 0 || unfiltered == 0 || scale == 0) {
raw = 0;
} else if (filtered == 0 || sgv < 40) {
} else if (filtered == 0 || sgv.y < 40) {
raw = scale * (unfiltered - intercept) / slope;
} else {
var ratio = scale * (filtered - intercept) / slope / sgv;
var ratio = scale * (filtered - intercept) / slope / sgv.y;
raw = scale * ( unfiltered - intercept) / slope / ratio;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/simplealarms.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function init() {

var rawbgProp = sbx.properties.rawbg;
if (rawbgProp) {
lines.push(['Raw BG:', rawbgProp.value, sbx.unitsLabel, rawbgProp.noiseLabel].join(' '));
lines.push(['Raw BG:', sbx.scaleBg(rawbgProp.value), sbx.unitsLabel, rawbgProp.noiseLabel].join(' '));
}

var bwp = sbx.properties.bwp && sbx.properties.bwp.bolusEstimateDisplay;
Expand Down

0 comments on commit 1cfdc03

Please sign in to comment.