summaryrefslogtreecommitdiff
path: root/prototype/fw/tools
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2020-12-01 19:36:02 +0100
committerjaseg <git@jaseg.de>2020-12-01 19:41:58 +0100
commit0e6fbeecf12d5176f0db75ad2752692b3c3a649d (patch)
tree739a86e4ff5ab2f9fbfb1f60bf5704e3298b7663 /prototype/fw/tools
parent2967dcee39e937248c21df59e6dbdd6336f8f9fb (diff)
downloadihsm-0e6fbeecf12d5176f0db75ad2752692b3c3a649d.tar.gz
ihsm-0e6fbeecf12d5176f0db75ad2752692b3c3a649d.tar.bz2
ihsm-0e6fbeecf12d5176f0db75ad2752692b3c3a649d.zip
paper: Add initial experimental results
Diffstat (limited to 'prototype/fw/tools')
-rw-r--r--prototype/fw/tools/ser_test.py13
1 files changed, 7 insertions, 6 deletions
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