summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--glucometerutils/drivers/sdcodefree.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/glucometerutils/drivers/sdcodefree.py b/glucometerutils/drivers/sdcodefree.py
index ac3e228..4636d2a 100644
--- a/glucometerutils/drivers/sdcodefree.py
+++ b/glucometerutils/drivers/sdcodefree.py
@@ -46,7 +46,7 @@ _PACKET = construct.Struct(
{e: e.value for e in Direction}),
'length' / construct.Rebuild(
construct.Byte, lambda this: len(this.message) + 2),
- 'message' / construct.Bytes(lambda this: len(this.message)),
+ 'message' / construct.Bytes(lambda this: this.length - 2),
'checksum' / construct.Checksum(
construct.Byte, xor_checksum, construct.this.message),
'etx' / construct.Const(0xAA, construct.Byte)