-
Notifications
You must be signed in to change notification settings - Fork 947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not filter using unit id in the received response #1076
Conversation
processIncomingPacket() can be told to ignore unit ids other than the specified one or accept all packets by specifying id 0 or 0xff. The modbus client would extract the unit id from the incoming data packet and use that for filtering. At best this is a no-op: the incoming unit id will match itself. At worst it makes us drop responses: if the data is fragmented each fragment was incorrectly parsed to extract a unit id. Remove the incoming unit id check at this stage. This change is behavior preserving if the response is not fragmented and fixes riptideio#688 if it is fragmented.
Seems your dev is a bit old, client_async* and server_async* works:
Please show how you get the error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, this might solve a couple of problems I have seen.
Let's see if CI gives green light.
The idea of processIncomingPacket() filtering unitId is not meant for the client, but for the server. If the server is connected as slave on a serial with multiple devices it needs to ignore packets for the other slaves. However there are a bug in that part as well. |
This fails for me:
Thanks for responding and merging uncannily quickly :-) |
you are behind:
and I just ran a test with the modbusRTUframer.
I do not have the serial available at the moment, due to the fact that I am updating the server side, and making some new tests that are more inclusive. However I expect to get around to do the serial testing later this week. |
processIncomingPacket() can be told to ignore unit ids other than the specified one or accept all packets by specifying id 0 or 0xff. The modbus client would extract the unit id from the incoming data packet and use that for filtering. At best this is a no-op: the incoming unit id will match itself. At worst it makes us drop responses: if the data is fragmented each fragment was incorrectly parsed to extract a unit id.
Remove the incoming unit id check at this stage. This change is behavior preserving if the response is not fragmented and fixes riptideio#688 if it is fragmented.
Note: I have not tested this with current dev because async RTU seems broken at the moment ("'ModbusRtuFramer' object is not callable").