From 6cb1b50c9dd773aa9cf801e7362d6eccb97722ec Mon Sep 17 00:00:00 2001 From: Tom Early Date: Mon, 30 Mar 2020 13:57:48 -0700 Subject: [PATCH] try some debugging --- QnetGateway.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/QnetGateway.cpp b/QnetGateway.cpp index 74bd989..a38b196 100644 --- a/QnetGateway.cpp +++ b/QnetGateway.cpp @@ -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 }