From 7fdc40613d01823746513e430db3f0018b63b145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sun, 31 Mar 2019 00:11:33 +0000 Subject: fslibre: correct the ketone reading. As discussed in glucometer-protocols #6, the value is actually converted the same way as blood glucose, despite it not having the same ratio. --- glucometerutils/drivers/fslibre.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/glucometerutils/drivers/fslibre.py b/glucometerutils/drivers/fslibre.py index f8e3117..ecf6dd6 100644 --- a/glucometerutils/drivers/fslibre.py +++ b/glucometerutils/drivers/fslibre.py @@ -93,8 +93,15 @@ def _extract_timestamp(parsed_record): def _convert_ketone_unit(raw_value): - """Convert raw ketone value as read in the device to its value in mmol/L.""" - return int((raw_value + 1) / 2.) / 10. + """Convert raw ketone value as read in the device to its value in mmol/L. + + As per + https://flameeyes.github.io/glucometer-protocols/abbott/freestyle-libre.html + this is actually not using any mg/dL→mmol/L conversion, but rather the same + as the meter uses for blood glucose. + + """ + return raw_value // 18 def _parse_arresult(record): -- cgit v1.2.3