allow only one MODBUS retry
- More than one retry usually makes no sense, as random errors are usually corrected. If the first retry also fails, the chance that a second or third retry will be successful is very small
This commit is contained in:
@@ -83,7 +83,7 @@ class Modbus():
|
|||||||
'''Response handler to forward the response'''
|
'''Response handler to forward the response'''
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
'''MODBUS response timeout in seconds'''
|
'''MODBUS response timeout in seconds'''
|
||||||
self.max_retries = 3
|
self.max_retries = 1
|
||||||
'''Max retransmit for MODBUS requests'''
|
'''Max retransmit for MODBUS requests'''
|
||||||
self.retry_cnt = 0
|
self.retry_cnt = 0
|
||||||
self.last_req = b''
|
self.last_req = b''
|
||||||
@@ -103,7 +103,7 @@ class Modbus():
|
|||||||
self.tim = None
|
self.tim = None
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
logging.info(f'Modbus __del__:\n {self.counter}')
|
logging.debug(f'Modbus __del__:\n {self.counter}')
|
||||||
|
|
||||||
def build_msg(self, addr: int, func: int, reg: int, val: int) -> None:
|
def build_msg(self, addr: int, func: int, reg: int, val: int) -> None:
|
||||||
"""Build MODBUS RTU request frame and add it to the tx queue
|
"""Build MODBUS RTU request frame and add it to the tx queue
|
||||||
|
|||||||
Reference in New Issue
Block a user