Closed timyhac closed 1 year ago
Over the holiday weekend (here in the US), I'll do some testing to make sure that the Modbus code is actually generating the right events. That will tackle this problem from the other end.
@kyle-github do you have a good modbus simulator or even some automated tests for modbus?
In the src/tests/ directory I have a couple files that do testing. One is a small wrapper (in Python) around libmodbus which is a C-based library that is very, very widely used for Modbus on Linux. This sets up a small Modbus server with some registers. The other is run_tests.sh which is just a shell script that runs 20+ specific tests against my real hardware and this Modbus simulator and against my CIP simulator. The CI system runs a subset of these since there is no PLC hardware in GitHub's test runner pool.
That said, I don't have the ability to inject delays or faults into the Modbus tests like I do with the CIP tests (delays are supported and used to test timeouts).
This PR modifies the
Initialize
/InitializeAsync
methods to make use ofplc_tag_create_ex
instead ofplc_tag_create
- which allows us to capture events early in the tag lifecycle.