There is a timing issue with the Modbus libraries that are linked. If you have more than 1 device on the bus thatis not based on this code and and it responds very quickly, the driver cannot handle this and loses bytes. If all the devices are your own, you can expect it to work.
I was using a Schneider Altivar VSD and one of my own devices running a G120 with the above code. The master was a Schneider PLC. It worked perfectly when only talking to the G120 based system but once the VSD was added as a second device, the G120 failed to handle the reply from the VSD as the first 1-2 bytes were lost each time.
I tried in vain to get it to work but eventually we ended up adding a second RS485 port on the PLC to talk to my G120 device. Rock solid ever since.
The new design uses an ATMEGA128 instead of the G120 and this works fine with both so I know the issue was the library. Something to do with the timing in the thread that handles the UART bytes.