Skip to content

Commit

Permalink
fix: Fixed how Modbus tags produce their array-info
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdutz committed Oct 2, 2024
1 parent 24c9392 commit 4de3701
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public String getAddressString() {
address += ":" + getDataType().name();
}
if(!getArrayInfo().isEmpty()) {
address += "[" + getArrayInfo().get(0).getUpperBound() + "]";
address += "[" + (getArrayInfo().get(0).getUpperBound() + 1) + "]";
}
return address;
}
Expand Down Expand Up @@ -158,7 +158,7 @@ public PlcValueType getPlcValueType() {
@Override
public List<ArrayInfo> getArrayInfo() {
if(quantity != 1) {
return Collections.singletonList(new DefaultArrayInfo(0, quantity));
return Collections.singletonList(new DefaultArrayInfo(0, quantity - 1));
}
return Collections.emptyList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private void verifyModbusTag(List<String> tagPatterns,
int allowedMax,
Class<? extends ModbusTag> expectedClass,
int expectedAddressShift) {
// Ensure all tagpatterns compile to the right tag
// Ensure all tag patterns compile to the right tag
for (int i = 1; i <= allowedMax; i++) {
List<ModbusTag> tags = new ArrayList<>();
for (String tagPattern : tagPatterns) {
Expand Down

0 comments on commit 4de3701

Please sign in to comment.