Closed bigjiongeagle closed 4 months ago
if this commit merge to the master branch. all the other example project private configfile named "ModbusConfig.h" should be edit to add the code like this: " #define MODBUS_BROADCAST_ADDRESS 0 // The broadcast address number "
Hi, Thanks for this PR. I have some comments:
The MODBUS_BROADCAST_ADDRESS is always 0, it is a reserved address. So adding it as a configuration parameter is not needed and must be avoided altogether. Please refer to the official Modbus specification here: https://www.modbus.org/docs/Modbus_over_serial_line_V1_02.pdf page 8 section 2.2
Broadcast must be implemented only for writing operations (section 2.1 of the aforementioned document), so all reading function codes must be ignored. The current implementation is not answering the master, but still processing the request which is not desirable.
If a PR breaks the examples, it must correct all examples, otherwise it will be rejected. There is no exception.
Thanks, Alejandro
Hi, Thanks for this comments.
The code will be update later.
Thanks, bigjiongeagle
Hi, The code has been updated:
1.add enum mb_address_t to the file named "Modbus.h", to Identifies whether it is a broadcast command.
2.Broadcast was implemented only for writing operations , all reading function codes has been ignored.
3.reset private configfile, so the PR will not breaks the examples.
4.In broadcast mode, when the validateRequest function returns an error, it does not reply to the data frame.
Thanks, bigjiongeagle
thanks for the PR
test with F030 example