Skip to content

Commit

Permalink
Add single char wait time after flush to avoid RTU control pin timing…
Browse files Browse the repository at this point in the history
… issue, see #68 and #72
  • Loading branch information
brainelectronics committed Jul 19, 2023
1 parent 481efde commit 08670e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<!-- ## [Unreleased] -->

## Released
## [2.3.7] - 2023-07-19
### Fixed
- Add a single character wait time after flush to avoid timing issues with RTU control pin, see #68 and #72

## [2.3.6] - 2023-07-19
### Added
- Add contribution guideline, see #67
Expand Down Expand Up @@ -303,8 +307,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- PEP8 style issues on all files of [`lib/uModbus`](lib/uModbus)

<!-- Links -->
[Unreleased]: https://github.com/brainelectronics/micropython-modbus/compare/2.3.6...develop
[Unreleased]: https://github.com/brainelectronics/micropython-modbus/compare/2.3.7...develop

[2.3.7]: https://github.com/brainelectronics/micropython-modbus/tree/2.3.7
[2.3.6]: https://github.com/brainelectronics/micropython-modbus/tree/2.3.6
[2.3.5]: https://github.com/brainelectronics/micropython-modbus/tree/2.3.5
[2.3.4]: https://github.com/brainelectronics/micropython-modbus/tree/2.3.4
Expand Down
2 changes: 2 additions & 0 deletions umodbus/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,10 @@ def _send(self, modbus_pdu: bytes, slave_addr: int) -> None:
# 360-400us @ 9600-115200 baud (measured) (ESP32 @ 160/240MHz)
self._uart.write(modbus_adu)
send_finish_time = time.ticks_us()

if self._has_uart_flush:
self._uart.flush()
time.sleep_us(self._t1char)
else:
sleep_time_us = (
self._t1char * len(modbus_adu) - # total frame time in us
Expand Down

0 comments on commit 08670e6

Please sign in to comment.