aldas / modbus-tcp-client

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

High level API should support custom endian for each address #81

Closed aldas closed 3 years ago

aldas commented 3 years ago

See discussion https://github.com/aldas/modbus-tcp-client/discussions/80

I'd prefer the high-level API for my system, but I need another endian (BIG_ENDIAN_LOW_WORD_FIRST)). Is ist possible to change endian directly for each address. Maybe something like this from your example ->int16(657, 'battery3_voltage_wo','BIG_ENDIAN_LOW_WORD_FIRST') or is it a must to use the low-level solution for another endian?

gutschein commented 3 years ago

Would be nice, but as the change of the default endian was already very helpfull. It may deserve a line in the help in chapter "Endianness": "Changing the default endian with adding a line at the beginning: Endian::$defaultEndian = Endian::<needed_endian>;"