Skip to content

Commit

Permalink
Merge branch 'dev_openaps_mmol_fix' of github.com:dsnallfot/cgm-remot…
Browse files Browse the repository at this point in the history
…e-monitor into wip/bewest/collaborations
  • Loading branch information
bewest committed Dec 13, 2024
2 parents ec5d75e + 31abf4e commit 1938a76
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/plugins/openaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,15 @@ function init (ctx) {

if ('enacted' === prop.status.code) {
var canceled = prop.lastEnacted.rate === 0 && prop.lastEnacted.duration === 0;
var bg = prop.lastEnacted.bg;
var units = sbx.data.profile.getUnits();

if (units === 'mmol') {
bg = Math.round(bg / consts.MMOL_TO_MGDL * 10) / 10;
}

var valueParts = [
valueString('BG: ', prop.lastEnacted.bg)
valueString('BG: ', bg)
, ', <b>Temp Basal' + (canceled ? ' Canceled' : ' Started') + '</b>'
, canceled ? '' : ' ' + prop.lastEnacted.rate.toFixed(2) + ' for ' + prop.lastEnacted.duration + 'm'
, valueString(', ', prop.lastEnacted.reason)
Expand Down

0 comments on commit 1938a76

Please sign in to comment.