You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe there is an issue in src/codec/rtu/mod.rs in fn request_pdu_len.
You may want to check the Modbus application protocol spec, sections 6.11 and 6.12, to make sure.
IMHO, the function should look like this:
Specifically, for function codes 0x0F and 0x10, adu_buf[6], not adu_buf[4], should be used to determine the PDU length.
This change fixed an issue in my application. I'd appreciate it if you integrate it in your crate.
The text was updated successfully, but these errors were encountered:
Shouldn't the check for 0x0F (Write Multiple Coils) be divided by 8 (plus or minus 1), to reflect how the following values are bitpacked to 1 byte per 8 coils (with the 9th coil bumping the data part up to 2 bytes)?
So something like
let quantity = u16::from_be_bytes([adu_buf[4], adu_buf[5]]);let expected_count = if quantity % 8 == 0{
quantity.saturating_div(8)}else{
quantity.saturating_div(8) + 1};
I believe there is an issue in src/codec/rtu/mod.rs in fn request_pdu_len.
You may want to check the Modbus application protocol spec, sections 6.11 and 6.12, to make sure.
IMHO, the function should look like this:
Specifically, for function codes 0x0F and 0x10, adu_buf[6], not adu_buf[4], should be used to determine the PDU length.
This change fixed an issue in my application. I'd appreciate it if you integrate it in your crate.
The text was updated successfully, but these errors were encountered: