Skip to content

Commit

Permalink
fix: Fixed an issue with calculating the endingAddress of a coil-resp…
Browse files Browse the repository at this point in the history
…onse.
  • Loading branch information
chrisdutz committed Sep 18, 2024
1 parent d3f2cf8 commit 96fc493
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ protected static class Response {
public Response(int startingAddress, byte[] responseData) {
this.startingAddress = startingAddress;
this.responseData = responseData;
this.endingAddressCoil = responseData.length * 8;
this.endingAddressCoil = startingAddress + responseData.length * 8;
// In general a "Celil(responseData.length / 2)" would have been more correct,
// but the data returned from the device should already be an even number.
this.endingAddressRegister = startingAddress + (responseData.length / 2);
Expand Down

0 comments on commit 96fc493

Please sign in to comment.