Skip to content
Snippets Groups Projects
Commit 22d97295 authored by Daniele Nicolodi's avatar Daniele Nicolodi
Browse files

pfeifferRS485: Improve dump command and allow for unknown parameters

parent 056a1203
No related branches found
No related tags found
No related merge requests found
...@@ -174,11 +174,13 @@ def dump(dev, decode): ...@@ -174,11 +174,13 @@ def dump(dev, decode):
while True: while True:
addr, op, reg, data = dev.recv() addr, op, reg, data = dev.recv()
print(f'{addr} {op} {reg} {data}') print(f'{addr} {op} {reg} {data}')
if decode: if decode and op == Op.RESPONSE:
param = PARAMETERS[reg] param = PARAMETERS.get(reg)
if op == Op.RESPONSE: if param:
value = param.decode(data) value = param.decode(data)
print(f'{addr}:{reg} "{param.description}" = {value}') print(f'{addr}:{reg}: "{param.description}" {value}')
else:
print(f'{addr}:{reg}: UNKNOWN')
def _collect(dev, params): def _collect(dev, params):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment