485 fuzzer
This commit is contained in:
parent
f1fbb9afb9
commit
165c361a6b
@ -3,8 +3,7 @@
|
||||
# Test: 485 fuzzer
|
||||
# ----------------
|
||||
# Repeatedly write random data to sensor via 485.
|
||||
# After that, try to read some input registers.
|
||||
# (address and baudrate is hardcoded)
|
||||
# (after thataddress and baudrate is hardcoded)
|
||||
#
|
||||
# Return 0 if read was successful, 1 otherwise.
|
||||
#
|
||||
@ -27,3 +26,8 @@ for i in range(0,16):
|
||||
if bytes_sent != len(random_data):
|
||||
print(f'Warning: failed to write all bytes (sent {bytes_sent}/{len_random_data})')
|
||||
time.sleep(0.05)
|
||||
serial_device.close()
|
||||
# read sensor
|
||||
s = Sensor(address=address, baudrate=baudrate)
|
||||
print(f'Trying to read sensor:\n\tTemperature {s.T} C\n\tCO2 {s.CO2} ppm')
|
||||
s.close()
|
||||
|
Loading…
Reference in New Issue
Block a user