stephane / modbusino

Small Modbus slave, RTU (serial) for Arduino
http://libmodbus.org
ISC License
143 stars 94 forks source link

timing: Don't wait then abort without checking again. #9

Closed karlp closed 5 years ago

karlp commented 9 years ago

If you're looking for available bytes, you should check for available, then if it's timed out, and then wait and check again, not check, wait, timeout. The final step effectively waits for 1 loop less, and needlessly blocks. While this has very little impact at common baud rates, and with the fixed loop counter in the current implementation, if this loop counter is replaced with a baud rate appropriate timeout, you can run into problems here due to overly eager "timeouts"

stephane commented 5 years ago

Merged. Thank you again ;)