Merge
This commit is contained in:
commit
f643048c17
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
from sensor import Sensor
|
||||
from sys import argv,exit
|
||||
from sys import argv, exit
|
||||
from flask import Flask
|
||||
from time import sleep
|
||||
from time import sleep, time
|
||||
import threading
|
||||
|
||||
app = Flask('Sensor central unit')
|
||||
@ -43,7 +43,7 @@ flask_thread.start()
|
||||
while True:
|
||||
# logging: for now just writing to csv file (can be anything: write to db, mqtt...)
|
||||
for s in sensors:
|
||||
log_string = ''
|
||||
log_string = f'{time():.1f} '
|
||||
for reg_name, reg_number in s.input_registers.items():
|
||||
with modbus_mutex:
|
||||
log_string += str(int(s.read_register(reg_number))) + ' '
|
||||
|
14
tests/test_485_fuzz.py
Normal file
14
tests/test_485_fuzz.py
Normal file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Test: 485 fuzzer
|
||||
# ----------------
|
||||
# Repeatedly write random data to sensor via 485.
|
||||
# After that, try to read some input registers.
|
||||
# (address and baudrate is hardcoded)
|
||||
#
|
||||
# Return 0 if read was successful, 1 otherwise.
|
||||
#
|
||||
import serial
|
||||
import minimalmodbus
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user