Fixed MODBUS slave callback when SPS30 is not connected
This commit is contained in:
1 parent
7e1e71a912
commit
c9d28bd48f
3 files changed
+17
-6
No files matched your search
@@ -121,9 +121,9 @@ if action == 'read' or action == 'all':
|
||||
reg_name = ''
|
||||
try:
|
||||
result = s.read_register(reg_number)
|
||||
except ValueError:
|
||||
print(f'Register number {reg_number} cannot be read (wrong number?)')
|
||||
exit(-8)
|
||||
except:
|
||||
print(f'{reg_number : <10} {"N/A" : <10} Failed to read register')
|
||||
continue
|
||||
print(f'{reg_number : <10} {int(result) : <10} {reg_name}')
|
||||
elif action == 'write':
|
||||
if len(register_name) > 0:
|
||||
|
||||
Reference in new issue
Block a user