Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix byte count when for WriteMultipleCoils (#105)
For full bytes, the Byte Count field was calculated too high: 8 // 8 + 1 = 2 while only one byte is needed to represent 8 coils. Offset the values length before the truncating division to correctly round to whole bytes. This is easier than what the standard formulates: N = Quantity of Outputs / 8, if the remainder is different of 0 ==> N = N+1 Note that the actual data bytes were already handled with the correct length. So in case of 8 coils, uModbus would send a Byte Count of 2, but only one data byte before the checksum.
- Loading branch information