Skip to content

Commit f2fe48e

Browse files
Carlos Gomezdhoomakethu
authored andcommitted
Update sync.py
The _strict argument should be defaulted to False since the inter_char_timeout feature is not working correctly. Changes in the past have tried to fix the issue but one way or another they do not seem to work consistently across all computers and systems. Therefore I think by default the _strict argument should be set to False unless specified to prevent the faulty behavior from producing false timeouts. There are two possible reasons why I think this feature may never work correclty: * One the OS handling the timeout incorrectly if more than one character arrives at the same time if it is busy doing something else. * Another one as described here https://stackoverflow.com/a/37053542/1813498 is the fact that the timeout value must be a multiple of 0.1. At 9600 the inter char value is calculated to be 0.00171875 and then rounded to 0 so therefore it will not work correctly. The conclusion from my side is that it is not possible to accurately measure this timeout and should perhaps be removed. At least it should be by default disabled. This small patch aims to do the later.
1 parent f31e395 commit f2fe48e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pymodbus/client/sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def __init__(self, method='ascii', **kwargs):
571571
self.parity = kwargs.get('parity', Defaults.Parity)
572572
self.baudrate = kwargs.get('baudrate', Defaults.Baudrate)
573573
self.timeout = kwargs.get('timeout', Defaults.Timeout)
574-
self._strict = kwargs.get("strict", True)
574+
self._strict = kwargs.get("strict", False)
575575
self.last_frame_end = None
576576
self.handle_local_echo = kwargs.get("handle_local_echo", False)
577577
if self.method == "rtu":

0 commit comments

Comments
 (0)