aldas / modbus-tcp-client

PHP client for Modbus TCP and Modbus RTU over TCP (can be used for serial)
Apache License 2.0
191 stars 55 forks source link

AddressSplitter can avoid unadressable ranges when splitting read requests #141

Closed aldas closed 1 year ago

aldas commented 1 year ago

AddressSplitter can avoid unadressable ranges when splitting read requests.

Fixes #135

Example:

        $requests = ReadRegistersBuilder::newReadHoldingRegisters('tcp://127.0.0.1:5022')
            ->unaddressableRanges([ [100,110], [256, 300], [512] ])
            ->uint16(100, 'gen1_fuel_rate_wo')
            ->uint16(111, 'gen2_fuel_rate_wo')
            ->uint16(112, 'gen3_fuel_rate_wo')
            ->build();
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +98.72 :tada:

Comparison is base (b6c9646) 0.00% compared to head (e59f0a9) 98.72%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #141 +/- ## ============================================= + Coverage 0 98.72% +98.72% - Complexity 0 887 +887 ============================================= Files 0 69 +69 Lines 0 2277 +2277 ============================================= + Hits 0 2248 +2248 - Misses 0 29 +29 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `98.72% <100.00%> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martti+T.#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://app.codecov.io/gh/aldas/modbus-tcp-client/pull/141?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martti+T.) | Coverage Δ | | |---|---|---| | [src/Composer/AddressSplitter.php](https://app.codecov.io/gh/aldas/modbus-tcp-client/pull/141?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martti+T.#diff-c3JjL0NvbXBvc2VyL0FkZHJlc3NTcGxpdHRlci5waHA=) | `100.00% <100.00%> (ø)` | | | [src/Composer/Range.php](https://app.codecov.io/gh/aldas/modbus-tcp-client/pull/141?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martti+T.#diff-c3JjL0NvbXBvc2VyL1JhbmdlLnBocA==) | `100.00% <100.00%> (ø)` | | | [src/Composer/Read/ReadCoilsBuilder.php](https://app.codecov.io/gh/aldas/modbus-tcp-client/pull/141?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martti+T.#diff-c3JjL0NvbXBvc2VyL1JlYWQvUmVhZENvaWxzQnVpbGRlci5waHA=) | `100.00% <100.00%> (ø)` | | | [src/Composer/Read/ReadRegistersBuilder.php](https://app.codecov.io/gh/aldas/modbus-tcp-client/pull/141?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martti+T.#diff-c3JjL0NvbXBvc2VyL1JlYWQvUmVhZFJlZ2lzdGVyc0J1aWxkZXIucGhw) | `100.00% <100.00%> (ø)` | | ... and [65 files with indirect coverage changes](https://app.codecov.io/gh/aldas/modbus-tcp-client/pull/141/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Martti+T.)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.