Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modbus_tk/modbus_rtu.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ def _do_run(self):

# Read rest of the request
while True:
# Add delays to avoid corrupting packages. (For use with FT232-RS485 device.)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"For use with FT232-RS485 device"???

But it's sitting under a while True and will affect every modbus_rtu device.

This will halt all execution for every modbus-rtu device prior to reading the rest of a request, a completely unessesary performance impact for many applications which do not warrant it.

I've had projects pushing near 500 requests per second, and i wouldn't be suprised if others are pushing higher, even if just in bench tests a 0.001s delay is massive in that regard.

time.sleep(0.001)
try:
read_bytes = self._serial.read(128)
if not read_bytes:
Expand Down