From da2388941e156953d117b18f047a31c1ed825cd2 Mon Sep 17 00:00:00 2001 From: Stefan Allius Date: Tue, 21 May 2024 19:37:55 +0200 Subject: [PATCH] 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 --- app/src/modbus.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/modbus.py b/app/src/modbus.py index 9cfeacd..fc262bd 100644 --- a/app/src/modbus.py +++ b/app/src/modbus.py @@ -83,7 +83,7 @@ class Modbus(): '''Response handler to forward the response''' self.timeout = timeout '''MODBUS response timeout in seconds''' - self.max_retries = 3 + self.max_retries = 1 '''Max retransmit for MODBUS requests''' self.retry_cnt = 0 self.last_req = b'' @@ -103,7 +103,7 @@ class Modbus(): self.tim = None 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: """Build MODBUS RTU request frame and add it to the tx queue