From 0e6fbeecf12d5176f0db75ad2752692b3c3a649d Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 1 Dec 2020 19:36:02 +0100 Subject: paper: Add initial experimental results --- prototype/fw/tools/ser_test.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'prototype/fw/tools') diff --git a/prototype/fw/tools/ser_test.py b/prototype/fw/tools/ser_test.py index 8680f46..ebd95ed 100644 --- a/prototype/fw/tools/ser_test.py +++ b/prototype/fw/tools/ser_test.py @@ -32,15 +32,15 @@ if __name__ == '__main__': while True: data = ser.read() for c in data: - if byte_count == 0: - print(f'\033[38;5;244m{time.time() - start_time: 8.3f} \033[0m', end='') + #if byte_count == 0: + #print(f'\033[38;5;244m{time.time() - start_time: 8.3f} \033[0m', end='') col = '\033[91m' if c == 0 else '\033[0m' # if c == (lastc - 1) % 256 else '\033[92m') - print(f'{col}{c:02x}', end=' ') + #print(f'{col}{c:02x}', end=' ') line += bytes([c]) byte_count += 1 if c == 0: - print(' ' * (16 - byte_count), end='\033[0m\n') + #print(' ' * (16 - byte_count), end='\033[0m\n') byte_count = 16 try: payload = cobs.decode(packet) @@ -51,7 +51,8 @@ if __name__ == '__main__': else: crc_ok = False ref_crc = '' - print(' '.join(f'{col if col else ""}{c if c else 0:02x}' for col, c in itertools.zip_longest(field_colors, + if len(payload) == 12: + print(' '.join(f'{col if col else ""}{c if c else 0:02x}' for col, c in itertools.zip_longest(field_colors, payload)), 'OK' if crc_ok else f'WRONG') except cobs.DecodeError: print('COBS framing error') @@ -61,7 +62,7 @@ if __name__ == '__main__': isprint = lambda c: c in b'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ ' if byte_count == 16: printable = ''.join( chr(c) if isprint(c) else '.' for c in line ) - print(f'\033[93m | {printable}\033[0m') + #print(f'\033[93m | {printable}\033[0m') byte_count = 0 line = b'' lastc = c -- cgit