summaryrefslogtreecommitdiffstats
path: root/glucometerutils/support
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas@sandberg.pp.se>2019-05-19 20:47:28 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.com>2019-05-19 21:49:32 +0200
commit2f697eb803f523380f95cd18d8f1fef85afa73ef (patch)
tree4decb468e8a5596974fe02ad91760e7200a68e5a /glucometerutils/support
parentfreestyle support: restore correct order of parameters. (diff)
downloadglucometerutils-2f697eb803f523380f95cd18d8f1fef85afa73ef.tar
glucometerutils-2f697eb803f523380f95cd18d8f1fef85afa73ef.tar.gz
glucometerutils-2f697eb803f523380f95cd18d8f1fef85afa73ef.tar.bz2
glucometerutils-2f697eb803f523380f95cd18d8f1fef85afa73ef.tar.lz
glucometerutils-2f697eb803f523380f95cd18d8f1fef85afa73ef.tar.xz
glucometerutils-2f697eb803f523380f95cd18d8f1fef85afa73ef.tar.zst
glucometerutils-2f697eb803f523380f95cd18d8f1fef85afa73ef.zip
Diffstat (limited to 'glucometerutils/support')
-rw-r--r--glucometerutils/support/freestyle.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/glucometerutils/support/freestyle.py b/glucometerutils/support/freestyle.py
index 816af81..d18a81f 100644
--- a/glucometerutils/support/freestyle.py
+++ b/glucometerutils/support/freestyle.py
@@ -64,6 +64,16 @@ def _verify_checksum(message, expected_checksum_hex):
if expected_checksum != calculated_checksum:
raise exceptions.InvalidChecksum(expected_checksum, calculated_checksum)
+def convert_ketone_unit(raw_value):
+ """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.0
class FreeStyleHidDevice(hiddevice.HidDevice):
"""Base class implementing the FreeStyle HID common protocol.