Skip to content

Commit 91aff20

Browse files
committed
Change debug prints
1 parent 6d6b0e6 commit 91aff20

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

src/SparkFun_Unicore_GNSS_Arduino_Library.cpp

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ bool badNmeaChecksum(SEMP_PARSE_STATE *parse)
152152
// Display bad checksums
153153
if ((!badChecksum) && ptrUM980->_printBadChecksum)
154154
{
155-
ptrUM980->debugPrintf("UM980: Message improperly includes %c in checksum", parse->buffer[0]);
155+
ptrUM980->debugPrintf("Unicore Lib: Message improperly includes %c in checksum", parse->buffer[0]);
156156
ptrUM980->dumpBuffer(parse->buffer, parse->length);
157157
}
158158
return badChecksum;
@@ -227,7 +227,7 @@ bool UM980::begin(HardwareSerial &serialPort, Print *parserDebug, Print *parserE
227227
"SFE_Unicore_GNSS_Library", parserError, parserDebug, badNmeaChecksum);
228228
if (!_sempParse)
229229
{
230-
debugPrintf("UM980: Failed to initialize the parser!");
230+
debugPrintf("Unicore Lib: Failed to initialize the parser!");
231231
return false;
232232
}
233233

@@ -335,7 +335,7 @@ bool UM980::updateOnce()
335335
endName = um980GetStateName(_sempParse);
336336

337337
// Display the parser state transition
338-
debugPrintf("UM980: 0x%02x (%c), crc: 0x%08x, state: %s --> %s", incoming,
338+
debugPrintf("Unicore Lib: 0x%02x (%c), crc: 0x%08x, state: %s --> %s", incoming,
339339
((incoming >= ' ') && (incoming < 0x7f)) ? incoming : '.', _sempParse->crc, startName, endName);
340340
}
341341
return (true);
@@ -430,21 +430,21 @@ void um980ProcessMessage(SEMP_PARSE_STATE *parse, uint16_t type)
430430
switch (type)
431431
{
432432
case UM980_NMEA_PARSER_INDEX:
433-
ptrUM980->debugPrintf("Valid NMEA Sentence: %s, 0x%04x (%d) bytes", sempNmeaGetSentenceName(parse),
433+
ptrUM980->debugPrintf("Unicore Lib: Valid NMEA Sentence: %s, 0x%04x (%d) bytes", sempNmeaGetSentenceName(parse),
434434
parse->length, parse->length);
435435
break;
436436

437437
case UM980_UNICORE_HASH_PARSER_INDEX:
438-
ptrUM980->debugPrintf("Valid Unicore Hash (#) Sentence: %s, 0x%04x (%d) bytes",
438+
ptrUM980->debugPrintf("Unicore Lib: Valid Unicore Hash (#) Sentence: %s, 0x%04x (%d) bytes",
439439
sempUnicoreHashGetSentenceName(parse), parse->length, parse->length);
440440
break;
441441

442442
case UM980_RTCM_PARSER_INDEX:
443-
ptrUM980->debugPrintf("Valid RTCM message: 0x%04x (%d) bytes", parse->length, parse->length);
443+
ptrUM980->debugPrintf("Unicore Lib: Valid RTCM message: 0x%04x (%d) bytes", parse->length, parse->length);
444444
break;
445445

446446
case UM980_UNICORE_BINARY_PARSER_INDEX:
447-
ptrUM980->debugPrintf("Valid Unicore message: 0x%04x (%d) bytes", parse->length, parse->length);
447+
ptrUM980->debugPrintf("Unicore Lib: Valid Unicore message: 0x%04x (%d) bytes", parse->length, parse->length);
448448
break;
449449
}
450450
}
@@ -467,7 +467,7 @@ void um980ProcessMessage(SEMP_PARSE_STATE *parse, uint16_t type)
467467
// Does this response contain the command we are looking for?
468468
if (strcasecmp((char *)scratchPad->unicoreHash.sentenceName, ptrUM980->commandName) == 0) // Found
469469
{
470-
ptrUM980->debugPrintf("UM980: Query response: %s", parse->buffer);
470+
ptrUM980->debugPrintf("Unicore Lib: Query response: %s", parse->buffer);
471471
ptrUM980->commandResponse = UM980_RESULT_RESPONSE_COMMAND_OK;
472472
}
473473
break;
@@ -479,7 +479,7 @@ void um980ProcessMessage(SEMP_PARSE_STATE *parse, uint16_t type)
479479
strcasecmp((char *)scratchPad->nmea.sentenceName, "CONFIG") != 0) // Found
480480

481481
// Unknown response, ignore this message
482-
ptrUM980->debugPrintf("UM980: Message ignored: %s", parse->buffer);
482+
ptrUM980->debugPrintf("Unicore Lib: Message ignored: %s", parse->buffer);
483483
else
484484
{
485485
// Does this response contain the command we are looking for?
@@ -489,7 +489,7 @@ void um980ProcessMessage(SEMP_PARSE_STATE *parse, uint16_t type)
489489
if (responsePointer != nullptr) // Found
490490
{
491491
// Display the command response
492-
ptrUM980->debugPrintf("UM980: Command response: %s", parse->buffer);
492+
ptrUM980->debugPrintf("Unicore Lib: Known command response: %s", parse->buffer);
493493

494494
// Check to see if we got a command response
495495
responsePointer = strcasestr((char *)parse->buffer, "OK");
@@ -502,11 +502,17 @@ void um980ProcessMessage(SEMP_PARSE_STATE *parse, uint16_t type)
502502
responsePointer = strcasestr((char *)parse->buffer, "PARSING");
503503
if (responsePointer != nullptr) // Found
504504
{
505-
ptrUM980->debugPrintf("UM980: Error response: %s", parse->buffer);
505+
ptrUM980->debugPrintf("Unicore Lib: Error response: %s", parse->buffer);
506506
ptrUM980->commandResponse = UM980_RESULT_RESPONSE_COMMAND_ERROR;
507507
return;
508508
}
509509
}
510+
else
511+
{
512+
// Display the command response
513+
ptrUM980->debugPrintf("Unicore Lib: Unknown command response: %s", parse->buffer);
514+
ptrUM980->debugPrintf("Unicore Lib: Looking for command: %s", ptrUM980->commandName);
515+
}
510516
}
511517
break;
512518
}
@@ -971,7 +977,7 @@ Um980Result UM980::sendQuery(const char *command, uint16_t maxWaitMs)
971977
{
972978
if (wait++ == maxWaitMs)
973979
{
974-
debugPrintf("UM980: Response timeout");
980+
debugPrintf("Unicore Lib: Response timeout");
975981
unicoreLibrarySemaphoreBlock = false; // Allow external tasks to control serial hardware
976982
return (UM980_RESULT_TIMEOUT_RESPONSE);
977983
}
@@ -980,13 +986,13 @@ Um980Result UM980::sendQuery(const char *command, uint16_t maxWaitMs)
980986

981987
if (commandResponse == UM980_RESULT_RESPONSE_COMMAND_OK)
982988
{
983-
debugPrintf("UM980: Response received");
989+
debugPrintf("Unicore Lib: Response received");
984990
break;
985991
}
986992

987993
if (commandResponse == UM980_RESULT_RESPONSE_COMMAND_ERROR)
988994
{
989-
debugPrintf("UM980: Query failure");
995+
debugPrintf("Unicore Lib: Query failure");
990996
unicoreLibrarySemaphoreBlock = false; // Allow external tasks to control serial hardware
991997
return (UM980_RESULT_RESPONSE_COMMAND_ERROR);
992998
}
@@ -1009,7 +1015,7 @@ Um980Result UM980::sendString(const char *command, uint16_t maxWaitMs)
10091015
{
10101016
clearBuffer();
10111017

1012-
debugPrintf("UM980: Sending command %s", command);
1018+
debugPrintf("Unicore Lib: Sending command %s", command);
10131019
strncpy(commandName, command, sizeof(commandName)); // Copy to class so that parsers can see it
10141020
commandResponse = UM980_RESULT_RESPONSE_COMMAND_WAITING; // Reset
10151021

@@ -1023,21 +1029,21 @@ Um980Result UM980::sendString(const char *command, uint16_t maxWaitMs)
10231029
{
10241030
if (wait++ == maxWaitMs)
10251031
{
1026-
debugPrintf("UM980: Command timeout");
1032+
debugPrintf("Unicore Lib: Command timeout");
10271033
return (UM980_RESULT_TIMEOUT_RESPONSE);
10281034
}
10291035

10301036
updateOnce(); // Will call um980ProcessMessage()
10311037

10321038
if (commandResponse == UM980_RESULT_RESPONSE_COMMAND_OK)
10331039
{
1034-
debugPrintf("UM980: Command success");
1040+
debugPrintf("Unicore Lib: Command success");
10351041
break;
10361042
}
10371043

10381044
if (commandResponse == UM980_RESULT_RESPONSE_COMMAND_ERROR)
10391045
{
1040-
debugPrintf("UM980: Command error");
1046+
debugPrintf("Unicore Lib: Command error");
10411047
return (UM980_RESULT_RESPONSE_COMMAND_ERROR);
10421048
}
10431049

0 commit comments

Comments
 (0)