1
0
Fork 0

Fix the Wires-X length/block calculations.

ycs232-kbc
Jonathan Naylor 8 years ago
parent 12c2761fa8
commit 4a457c279b

@ -323,13 +323,22 @@ void CWiresX::createReply(const unsigned char* data, unsigned int length)
assert(data != NULL); assert(data != NULL);
assert(length > 0U); assert(length > 0U);
unsigned char bt = length / 260U; unsigned char bt = 0U;
if (length > 260U) {
bt = 1U;
bt += (length - 260U) / 259U;
length += bt; length += bt;
}
unsigned int blocks = (length - 10U) / 20U; if (length > 20U) {
if ((length % 20U) > 0U) blocks++; unsigned int blocks = (length - 20U) / 40U;
length = blocks * 20U + 10U; if ((length % 40U) > 0U) blocks++;
length = blocks * 40U + 20U;
} else {
length = 20U;
}
unsigned char ft = calculateFT(length, 0U); unsigned char ft = calculateFT(length, 0U);

Loading…
Cancel
Save