You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@plc4x.apache.org by "IsmoLeszczynski (via GitHub)" <gi...@apache.org> on 2025/04/14 08:35:51 UTC
[I] [Bug]: Modbus: ModbusOptimizer doesn't check tag specific endianness
IsmoLeszczynski opened a new issue, #2058:
URL: https://github.com/apache/plc4x/issues/2058
### What happened?
`ModbusOptimizer.processReadResponses(...)` always uses the connection default endianness when processing the results, instead of checking for tag specific configurations:
```java
byte[] responseData = response.getResponseDataForTag(modbusTag);
ReadBuffer readBuffer = getReadBuffer(responseData, modbusContext.getByteOrder());
try {
PlcValue plcValue = DataItem.staticParse(readBuffer, modbusTag.getDataType(),
modbusTag.getNumberOfElements(),
modbusContext.getByteOrder() == ModbusByteOrder.BIG_ENDIAN);
values.put(tagName, new DefaultPlcResponseItem<>(PlcResponseCode.OK, plcValue));
} catch (ParseException e) {
values.put(tagName, new DefaultPlcResponseItem<>(PlcResponseCode.INTERNAL_ERROR, null));
}
```
I believe the byte-order should be taken from the `modbusTag.getByteOrder()` if available, and fallback to the default? I have a fix for this that I can PR, but it's built on top of #2055, which is still under review.
### Version
v0.13.0-SNAPSHOT
### Programming Languages
- [ ] plc4c
- [ ] plc4go
- [x] plc4j
- [ ] plc4net
- [ ] plc4py
### Protocols
- [ ] AB-Ethernet
- [ ] ADS /AMS
- [ ] BACnet/IP
- [ ] C-Bus
- [ ] CANopen
- [ ] EtherNet/IP
- [ ] Firmata
- [ ] IEC-69870
- [ ] KNXnet/IP
- [x] Modbus
- [ ] OPC-UA
- [ ] Profinet
- [ ] S7
- [ ] S7-light
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Modbus: ModbusOptimizer doesn't check tag specific endianness
Posted by "IsmoLeszczynski (via GitHub)" <gi...@apache.org>.
IsmoLeszczynski commented on issue #2058:
URL: https://github.com/apache/plc4x/issues/2058#issuecomment-2801311982
I don't have a current use-case, but I ran in to it when implementing the [Web of Things Modbus binding](https://w3c.github.io/wot-binding-templates/bindings/protocols/modbus/index.html) in our application, which allows defining the endianness and swapping per property. The only use-case I could imagine is a Modbus Gateway that aggregates different Modbus devices via UnitId - with PLC4X you could have one connection to the gateway and the modbusTags would define the specific UnitId + possible differing endiannes per underlying device.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Modbus: ModbusOptimizer doesn't check tag specific endianness
Posted by "IsmoLeszczynski (via GitHub)" <gi...@apache.org>.
IsmoLeszczynski commented on issue #2058:
URL: https://github.com/apache/plc4x/issues/2058#issuecomment-2809049992
The fix was so minor that I just added it to the earlier PR already.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Modbus: ModbusOptimizer doesn't check tag specific endianness
Posted by "chrisdutz (via GitHub)" <gi...@apache.org>.
chrisdutz commented on issue #2058:
URL: https://github.com/apache/plc4x/issues/2058#issuecomment-2801951252
Aaah ... ok .. yeah ... that makes sense ... will look into this especially your PR. Thanks for this.
I guess this whole "sharing of connections" is really something that we would need the SPI 3.0 for, but that's definitely not going to happen any time soon.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Modbus: ModbusOptimizer doesn't check tag specific endianness
Posted by "IsmoLeszczynski (via GitHub)" <gi...@apache.org>.
IsmoLeszczynski closed issue #2058: [Bug]: Modbus: ModbusOptimizer doesn't check tag specific endianness
URL: https://github.com/apache/plc4x/issues/2058
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Modbus: ModbusOptimizer doesn't check tag specific endianness
Posted by "chrisdutz (via GitHub)" <gi...@apache.org>.
chrisdutz commented on issue #2058:
URL: https://github.com/apache/plc4x/issues/2058#issuecomment-2801028165
Good catch ... yeah ... I think I didn't imeplement that when I implemented the optimizer. But sort of wierd use-case ... could you explain why this is an issue? Do you have a system where some tags are big endian and some little endian? (Or one of the odd modbus cases)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org