Closed MikePlante1 closed 3 months ago
I've tested this with manual glucose entries, temp targets, profile overrides, and target glucose. Setting it to a known problem number (like 7.6 or 8.1) in mmol/L and then switching to mg/dL and then switching back to mmol/L.
Success
Modify to mg/dL, add to list above the mg/dL value in parentheses.
Note that this PR does not solve rounding issues pointed out in this comment where settings can shift up to 1 mg/dL when switching units from mg/dL to mmol/L and then back to mg/dL.
I think the best way to solve that issue would be to update Trio so all mmol/L inputs are converted to mg/dL upon entry and only converted back to mmol/L when used for display. (Work has already begun on this in a private fork)
Addresses Issue #267
Currently, Trio just rounds down when logging a manual glucose entry in mmol/L. This means that 7.6 gets logged as 7.5 because 7.6 / 0.0555 ≈ 136.9 gets rounded to 136 when
Int(glucose)
is performed which gets displayed as 7.5 because 136 * 0.0555 ≈ 7.5.This PR rounds
asMgdL
to 0 decimal places andasMmolL
to 1 decimal place which allows for more accurate rounding when converting units and back.Here's a spreadsheet that highlights the mmol/L readings that caused mismatches: https://docs.google.com/spreadsheets/d/10ZHV7ZDd0_fjrV6k0FH1ouuqy2TSsDSBpBULE4yAFyg/edit?usp=sharing