QModbusClient: all subsequent modbus requests fail once a request had timedout
Hi there,
got a quick question about QModbusClient / QModbusDevice.
I'm using
Code:
QModbusReply * QModbusClient::sendReadRequest(const QModbusDataUnit &read, int serverAddress);
to send out modbus requests to a (successfully) connected device. When the modbus data unit is configured correctly, this works well and I can retrieve several registers one after another by sending a request and processing the reply.
When I send a request to a non-existing register (either due to configuration failure, or if the modbus hardware was configured differently), I will get a timeout on the request. This is to be expected and not problematic.
However, when afterwards a request is sent to a correctly configured register, this will also result in a timeout.
Example sequence:
- read register 30201 -> success
- read register 30230 -> timeout (register 30230 does not exist)
- read register 30201 -> timeout (why????)
I didn't find anything in the documentation (e.g. about clearing the error flag on the QModbusDevice or else).
Does anybody have an explanation or pointer to some overlooked part in the docs? Or maybe this is a bug?
Thanks for any ideas!
-Andreas
Re: QModbusClient: all subsequent modbus requests fail once a request had timedout
I haven't worked with this part of the API myself, but in general with cases such as this it is often most useful look into the code itself.
Usually the most efficient way to do that is to look for the class that is your entry point at the Woboq Code Browser.
For example here QModbusClient and then following the method that is being called.
Cheers,
_
Re: QModbusClient: all subsequent modbus requests fail once a request had timedout
Hi all,
just for your info. After updating to Qt 5.11.3 I cannot reproduce this issue anylonger. QModbusClient works fine now - i.e. even after timeout of a bad request the next valid request goes through as expected.
-Andreas