Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The doPartition method works incorrectly based on wrong assumption that register ranges doesn't have gaps #42

Open
PeterBorisenko opened this issue Jul 17, 2021 · 0 comments

Comments

@PeterBorisenko
Copy link

To Reproduce
Steps to reproduce the behavior:

  1. Use the following data offsets with RegisterRange.HOLDING_REGISTER
    private int initDataOffsets[]= {
            0x0710, // device name
            0x0711, // device name
            0x0712, // device name
            0x0780, // loads count
            0x1200, // phases num
    };
  1. Create batch read request
BatchRead<Integer> batch = new BatchRead<Integer>();
for (int i= 0; i < initDataOffsets.length; i++) {
    batch.addLocator(i, new ModbusLocator(16, RegisterRange.HOLDING_REGISTER, initDataOffsets[i],
DataType.TWO_BYTE_INT_UNSIGNED, (byte) 0));
}
  1. Try to poll device:
BatchResults<Integer> res= batchRead(master, batch);
  1. If device doesn't have registers between 0x0712 and 0x0780 defined, there will be an error and res will be null.

Expected behavior
List<ReadFunctionGroup<K>> functionGroups must be 3 here. But has 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant