self._stopbits = serial.STOPBITS_TWO
# 1.5 char and 3.5 char times for protocol timing
# (according to Modbus specification):
- self._t15 = 0.000750
+ self._t15 = 0.001000
self._t35 = 0.001750
if self.conf['baudrate'] <= 19200:
bit_per_char = 9
bit_per_char += 1
bit_per_char += self.conf['stopbits']
seconds_per_char = bit_per_char / self.conf['baudrate']
- self._t15 = 1.5 * seconds_per_char
+ self._t15 = 2.0 * seconds_per_char
self._t35 = 3.5 * seconds_per_char
# Queue for Modbus messages to be sent:
self._queue: asyncio.Queue = asyncio.Queue()
t35_task: asyncio.Task = asyncio.create_task(
asyncio.sleep(self._t35))
try:
- # First byte is awaited for response timeout:
first_byte = await asyncio.wait_for(
reader.read(1), self.conf['response timeout'])
modbus_response += first_byte
while True:
t35_task = asyncio.create_task(asyncio.sleep(self._t35))
try:
- # Subsequent bytes are only awaited for the time
- # needed to transmit 1.5 characters:
next_byte = await asyncio.wait_for(
reader.read(1), self._t15)
modbus_response += next_byte
self._stopbits = serial.STOPBITS_TWO
# 1.5 char and 3.5 char times for protocol timing
# (according to Modbus specification):
- self._t15 = 0.000750
+ self._t15 = 0.001000
self._t35 = 0.001750
if self._baudrate <= 19200:
bit_per_char = 11
self._stopbits == serial.STOPBITS_ONE):
bit_per_char = 10
seconds_per_char = bit_per_char / self._baudrate
- self._t15 = 1.5 * seconds_per_char
+ self._t15 = 2.0 * seconds_per_char
self._t35 = 3.5 * seconds_per_char
# Coils and registers:
self._coils: Dict[int, bool] = {}