summaryrefslogtreecommitdiff
path: root/lib/harness.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-11-14 17:09:29 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2019-11-14 17:09:29 +0100
commitfe0b0794fa4ea15960075de1e9ea2b27bc363406 (patch)
treece19adf4642f478f0cc3b02a66408b93df4e34bc /lib/harness.py
parenta38a45799288448181b1e895537dc8ce88a303b3 (diff)
TransitionHarnes: fix barcode transfer
Diffstat (limited to 'lib/harness.py')
-rw-r--r--lib/harness.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/harness.py b/lib/harness.py
index cd9a477..f08f8d2 100644
--- a/lib/harness.py
+++ b/lib/harness.py
@@ -144,7 +144,9 @@ class TransitionHarness:
def _pass_transition_call(self, transition_id):
if self.gpio_mode == 'bar':
barcode_bits = Code128('T{}'.format(transition_id), charset='B').modules
- barcode_bytes = [int("".join(map(str, reversed(barcode_bits[i:i+8]))), 2) for i in range(0, len(barcode_bits), 8)]
+ if len(barcode_bits) % 8 != 0:
+ barcode_bits.extend([1] * (8 - (len(barcode_bits) % 8)))
+ barcode_bytes = [255 - int("".join(map(str, reversed(barcode_bits[i:i+8]))), 2) for i in range(0, len(barcode_bits), 8)]
inline_array = "".join(map(lambda s: '\\x{:02x}'.format(s), barcode_bytes))
return 'ptalog.startTransition("{}", {});\n'.format(inline_array, len(barcode_bytes))
else: