Open embeddedmz opened 3 years ago
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Mohamed Amine Mzoughi. This is most likely caused by a git client misconfiguration; please make sure to:
git config --list | grep email
git config --global user.email email@example.com
We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...
@cla-bot check
We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...
The cla-bot has been summoned, and re-checked this pull request!
This part was already complex but with the splitting between software and hardware, it's even more complex but I think you need it so it makes sense to add this code.
As you proposed, proper documentation would be nice.
@stephane When you merge my other PR, let me know so I can update my master branch so you can merge this if everything is good for you.
On the other hand, if anyone needs this feature on Windows (I did it on Windows CE 7 in quick and dirty mode https://github.com/embeddedmz/libmodbus_trizeps_vii_arm_wince), in static int _modbus_rtu_connect(modbus_t *ctx)
, just use this statement somewhere:
/* Specifies that the RTS line will be high if bytes are available for transmission. After all buffered bytes have been sent, the RTS line will be low. */
dcb.fRtsControl = RTS_CONTROL_TOGGLE;
Maybe, I will work on that issue one day (making modbus_rtu_set_rts function also works on Windows platform).
@stephane the branch is now up to date and ready to be merged.
Hello,
Actually, in libmodbus, there's only RTS up or down setting via software and its accuracy depends on RTS delay value.
In this pull request, I added the possibility to use hardware RTS up or down setting (using the serial driver).
I made my tests with ModRSim2 (Modbus slave simulator running on Windows 10) and the Trizeps 7 board running Ubuntu 18.04 (i.MX6 CPU, the serial driver/UART is related to that CPU).
If this is good for you, I will add the proper documentation before you accept my changes.
Best regards.