eclipse-4diac / 4diac-forte

Eclipse Public License 2.0
30 stars 32 forks source link

Feature/modbus Fix Data Size for BYTE Data #211

Closed franz-hoepfinger-4diac closed 3 months ago

franz-hoepfinger-4diac commented 3 months ago

Without this Change on a Digital Out Module Writing Coils, only each 2nd Coil is activated.

azoitl commented 3 months ago

@kumajaya as you are currently for me the person knowing most about the modbus code: could you please be so kind and have a look on that PR?

diplfranzhoepfinger commented 3 months ago

@kumajaya please also look into matrix, there i described the Errors without this PR:

https://chat.eclipse.org/#/room/!yVjgkwgBPbjMVDziCd:matrix.eclipse.org/$cLPj0Q6aijRyREctr1TSCAE2OpR36xB2clgRh5YErv4?via=matrix.eclipse.org&via=matrix.org

mainly:

i used a Waveshare https://www.waveshare.com/wiki/Modbus_RTU_IO_8CH and it did only lit on every 2nd LED. 

the Reading did work correct, just the writing not.

diplfranzhoepfinger commented 3 months ago

20240820_003319_4689380727561284710_20240821114055

diplfranzhoepfinger commented 3 months ago

here a picture, i just realized Matrix not showing any pictures in the Moment.

kumajaya commented 3 months ago

Without this Change on a Digital Out Module Writing Coils, only each 2nd Coil is activated.

@azoitl @diplfranzhoepfinger I was able to reproduce the issue and this patch fixes it.

But I also found another issue, reuse previous connection not always working. The first client (with "modbus[rtu:/dev/ttyS0:9600:N:8:1::4:2000:i0..7]" parameter) always succeeds in reading Modbus data but the other clients (with "modbus[rtu:/dev/ttyS0:::::::2000:i8..15:]" parameter, "modbus[rtu:/dev/ttyS0:::::::2000:i16..23:]" parameter and so on) do not always do so.

diplfranzhoepfinger commented 3 months ago

Without this Change on a Digital Out Module Writing Coils, only each 2nd Coil is activated.

@azoitl @diplfranzhoepfinger I was able to reproduce the issue and this patch fixes it.

so THIS Fix can be merged, 

but

But I also found another issue, reuse previous connection not always working. The first client (with "modbus[rtu:/dev/ttyS0:9600:N:8:1::4:2000:i0..7]" parameter) always succeeds in reading Modbus data but the other clients (with "modbus[rtu:/dev/ttyS0:::::::2000:i8..15:]" parameter, "modbus[rtu:/dev/ttyS0:::::::2000:i16..23:]" parameter and so on) do not always do so.

we need another Fix for this.

azoitl commented 3 months ago

Would say so too.