Race condition: ModbusRTUServer.begin() sometimes quietly rejects config #135
Labels
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
I was experiencing a very difficult to debug issue with this library on my RP2040 wherein seemingly very similar code produced a different result. Ultimately this proved to be a race condition, in which
ModbusRTUServer.begin()
sometimes was not accurately loading in my provided serial format and instead used the default.Symptoms:
config
above, instead just using the default,SERIAL_8N1
Temporary resolution to issue:
ModbusRTUServerClass.begin()
multiple times (I put mine in afor
loop of 100 times). This is an extremely hacky solution and not guaranteed to work 100% of times, but it proves the issue exists in the wild.Proposed resolution:
Details:
The text was updated successfully, but these errors were encountered: