summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.eu>2016-08-31 21:32:34 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2016-08-31 21:32:34 +0200
commit5bebe9e39fe03189352186c1676fa8eaafac6f12 (patch)
tree5f4a407de51bc29f536bd670c5a5ad65df383284
parentfreestyle_optium: fix reversed parameters to map(). (diff)
downloadglucometerutils-5bebe9e39fe03189352186c1676fa8eaafac6f12.tar
glucometerutils-5bebe9e39fe03189352186c1676fa8eaafac6f12.tar.gz
glucometerutils-5bebe9e39fe03189352186c1676fa8eaafac6f12.tar.bz2
glucometerutils-5bebe9e39fe03189352186c1676fa8eaafac6f12.tar.lz
glucometerutils-5bebe9e39fe03189352186c1676fa8eaafac6f12.tar.xz
glucometerutils-5bebe9e39fe03189352186c1676fa8eaafac6f12.tar.zst
glucometerutils-5bebe9e39fe03189352186c1676fa8eaafac6f12.zip
-rw-r--r--glucometerutils/drivers/freestyle_optium.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/glucometerutils/drivers/freestyle_optium.py b/glucometerutils/drivers/freestyle_optium.py
index da6aa84..8a20657 100644
--- a/glucometerutils/drivers/freestyle_optium.py
+++ b/glucometerutils/drivers/freestyle_optium.py
@@ -29,12 +29,10 @@ _CLOCK_RE = re.compile(
# over what the meter was supposed to read. Unlike the "Clock:" line, the months
# of June and July are written in full, everything else is truncated to three
# characters, so accept a space or 'e'/'y' at the end of the month name. Also,
-# the time does *not* include seconds. Note that the G is likely going to
-# indicate a blood-glucose reading rather than a blood-β-ketones. Unfortunately
-# I don't have β-ketone strips to test.
+# the time does *not* include seconds.
_READING_RE = re.compile(
r'^(?P<reading>HI |[0-9]{3}) (?P<month>[A-Z][a-z]{2})[ ey] (?P<day>[0-9]{2}) '
- r'(?P<year>[0-9]{4}) (?P<time>[0-9]{2}:[0-9]{2}) G 0x00$')
+ r'(?P<year>[0-9]{4}) (?P<time>[0-9]{2}:[0-9]{2}) (?P<type>[GK]) 0x00$')
_CHECKSUM_RE = re.compile(
r'^(?P<checksum>0x[0-9A-F]{4}) END$')
@@ -254,6 +252,11 @@ class Device(object):
if not match:
raise exceptions.InvalidResponse(line)
+ if match.group('type') != 'G':
+ print('Non-glucose readings are not supported, ignoring.',
+ file=sys.stderr)
+ continue
+
if match.group('reading') == 'HI ':
value = float("inf")
else: