try some debugging

pull/14/head
Tom Early 6 years ago
parent a4bf2cd7d7
commit 6cb1b50c9d

@ -649,16 +649,17 @@ void CQnetGateway::ProcessG2Msg(const unsigned char *data, const int mod)
// we are in a message
if (part[mod] % 2) { // true when part[mod] = 1, 3, 5 or 7
// this is the second part of the 2-frame pair
memcpy(txt[mod]+(5*(part[mod]/2)+2), c, 3);
memcpy(txt[mod]+(5u*(part[mod]/2u)+2u), c, 3); // offset is 2, 7, 12 or 17
printf("part[%d]=%u Msg ='%s'\n", mod, part[mod], txt[mod]);
if (++part[mod] > 7) {
// we've got everything!
printf("Msg = '%s'\n", txt[mod]);
part[mod] = 0; // now we can start over
}
} else { // we'll get here when part[mod] = 2, 4 or 6
unsigned int sequence = part[mod]++ / 2; // this is the sequency we are expecting, 1, 2 or 3
if ((sequence | 0x40u) == c[0]) {
memcpy(txt[mod]+(5*sequence), c+1, 2); // got it! get the copy the two chars
printf("part[%d]=%u Msg='%s'\n", mod, part[mod]-1u, txt[mod]);
memcpy(txt[mod]+(5u*sequence), c+1, 2); // got it! get the copy the two chars
} else {
part[mod] = 0; // unexpected
}

Loading…
Cancel
Save

Powered by TurnKey Linux.