CMB27 / ModbusRTUSlave

This is an Arduino library that implements the slave/server logic of the Modbus RTU protocol.
MIT License
58 stars 14 forks source link

Pull Request: poll function added return status #40

Closed raymondecmach closed 3 weeks ago

raymondecmach commented 4 weeks ago

Thanks for create and maintain the library. Since I experienced difficulty on debugging when I use this library, I made some changes. For this pull request: 1) Modified the poll function to return the received command from master. 2) Added 3 arguments for poll function, so that developer can get error code, register start address and quantity of the processed command.

All the arguments are optional so that the code show be backward compatible to the existing code. You may feel free to edit the code, or we can discuss for further changes. Thanks

CMB27 commented 3 weeks ago

I can see you've done quite a bit of work here. I'm sorry you had trouble debugging, but I don't intend to merge your changes into the repository.

I've intentionally kept this library pretty simple; makes is easier to maintain and less to go wrong. These changes add quite a bit of complexity to the backend. I can see how these changes could be useful, but they go beyond a line I have drawn for myself. This library is not intended to be the be-all and end-all of Arduino Modbus slave/server libraries. Version 1 of this library was an attempt at that, but it became difficult to maintain and complex to use. Version 2 is a much simpler redesign that is intended cover most use cases, and to potentially serve as a starting point for more complex or application specific libraries or code.

I think what you've done is pretty cool, but it is not something I am interested in maintaining.

raymondecmach commented 3 weeks ago

Sure I agree not to merge the update if there is conflict with your intention, as maintaining the code from others is not an easy tasks Since I need to know which register was read by master, I will keep this change in my repo