Open cheetor5923 opened 4 years ago
I'm having trouble with this too. It seems to be taking 1500ms to timeout by default, which is strange to begin with as the default timeout appears to be 1000ms!
I've started looking into the code, and it looks like ArduinoModbus
is passing the args as seconds and milliseconds:
https://github.com/arduino-libraries/ArduinoModbus/blob/02abf6d250365a283cb8ea41562c1dd210dde496/src/ModbusClient.cpp#L422
while libmodbus is expecting the values as seconds and microseconds: https://github.com/arduino-libraries/ArduinoModbus/blob/02abf6d250365a283cb8ea41562c1dd210dde496/src/libmodbus/modbus.c#L1693-L1696
I'm not sure this is the current issue, as I'm trying to set it to 50ms, and even if that was passed over as 50us I would expect to see an almost instant timeout, however I'm still getting 1500ms timeout.
What's going on here!?
When called, ModbusRTUClient.setTimeout does not propagate the timeout to it's associated Stream class.