From 2f697eb803f523380f95cd18d8f1fef85afa73ef Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Sun, 19 May 2019 19:47:28 +0100 Subject: fsprecisionneo: Scale ketone readings to mmol/l The FreeStyle Optimum Neo reports ketones in using the same unit as FreeStyle Libre. Move the conversion function from fslibre.py to freestyle.py to facilitate sharing and do the right conversion in fsprecisionneo.py. --- glucometerutils/support/freestyle.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'glucometerutils/support') 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. -- cgit v1.2.3