@@ -63,13 +63,13 @@ boolean SFE_UBLOX_GPS::begin(Stream &serialPort)
6363
6464// Enable or disable the printing of sent/response HEX values.
6565// Use this in conjunction with 'Transport Logging' from the Universal Reader Assistant to see what they're doing that we're not
66- void RFID ::enableDebugging (Stream &debugPort)
66+ void SFE_UBLOX_GPS ::enableDebugging (Stream &debugPort)
6767{
6868 _debugSerial = &debugPort; // Grab which port the user wants us to use for debugging
6969
7070 _printDebug = true ; // Should we print the commands we send? Good for debugging
7171}
72- void RFID ::disableDebugging (void )
72+ void SFE_UBLOX_GPS ::disableDebugging (void )
7373{
7474 _printDebug = false ; // Turn off extra print statements
7575}
@@ -115,8 +115,8 @@ void SFE_UBLOX_GPS::setSerialRate(uint32_t baudrate, uint8_t uartPort, uint16_t
115115
116116 if (_printDebug == true )
117117 {
118- debug. print (" Current baud rate: " );
119- debug. println (((uint32_t )payloadCfg[10 ] << 16 ) | ((uint32_t )payloadCfg[9 ] << 8 ) | payloadCfg[8 ]);
118+ _debugSerial-> print (" Current baud rate: " );
119+ _debugSerial-> println (((uint32_t )payloadCfg[10 ] << 16 ) | ((uint32_t )payloadCfg[9 ] << 8 ) | payloadCfg[8 ]);
120120 }
121121
122122 packetCfg.cls = UBX_CLASS_CFG;
@@ -132,8 +132,8 @@ void SFE_UBLOX_GPS::setSerialRate(uint32_t baudrate, uint8_t uartPort, uint16_t
132132
133133 if (_printDebug == true )
134134 {
135- debug. print (" New baud rate:" );
136- debug. println (((uint32_t )payloadCfg[10 ] << 16 ) | ((uint32_t )payloadCfg[9 ] << 8 ) | payloadCfg[8 ]);
135+ _debugSerial-> print (" New baud rate:" );
136+ _debugSerial-> println (((uint32_t )payloadCfg[10 ] << 16 ) | ((uint32_t )payloadCfg[9 ] << 8 ) | payloadCfg[8 ]);
137137 }
138138
139139 sendCommand (packetCfg);
@@ -203,7 +203,7 @@ boolean SFE_UBLOX_GPS::checkUbloxI2C()
203203 {
204204 if (_printDebug == true )
205205 {
206- debug. println (" No bytes available" );
206+ _debugSerial-> println (" No bytes available" );
207207 }
208208 lastCheck = millis (); // Put off checking to avoid I2C bus traffic
209209 return true ;
@@ -259,10 +259,10 @@ void SFE_UBLOX_GPS::process(uint8_t incoming)
259259 if (_printDebug == true )
260260 {
261261 // if (currentSentence == NONE && incoming == 0xB5) //UBX binary frames start with 0xB5, aka μ
262- // debug. println(); //Show new packet start
262+ // _debugSerial-> println(); //Show new packet start
263263
264- // debug. print(" ");
265- // debug. print(incoming, HEX);
264+ // _debugSerial-> print(" ");
265+ // _debugSerial-> print(incoming, HEX);
266266 }
267267
268268 if (currentSentence == NONE || currentSentence == NMEA)
@@ -447,15 +447,18 @@ void SFE_UBLOX_GPS::processUBX(uint8_t incoming, ubxPacket *incomingUBX)
447447 {
448448 if (_printDebug == true )
449449 {
450- debug. print (" Received: " );
450+ _debugSerial-> print (" Received: " );
451451 printPacket (incomingUBX);
452452 }
453453 incomingUBX->valid = true ;
454454 processUBXpacket (incomingUBX); // We've got a valid packet, now do something with it
455455 }
456- if (_printDebug == true )
456+ else
457457 {
458- else debug.println (" Checksum failed. Response too big?" );
458+ if (_printDebug == true )
459+ {
460+ _debugSerial->println (" Checksum failed. Response too big?" );
461+ }
459462 }
460463 }
461464 else // Load this byte into the payload array
@@ -488,7 +491,7 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
488491 // The ack we just received matched the CLS/ID of last packetCfg sent
489492 if (_printDebug == true )
490493 {
491- debug. println (" Command sent/ack'd successfully" );
494+ _debugSerial-> println (" Command sent/ack'd successfully" );
492495 }
493496 commandAck = true ;
494497 }
@@ -535,7 +538,7 @@ boolean SFE_UBLOX_GPS::sendCommand(ubxPacket outgoingUBX, uint16_t maxWait)
535538
536539 if (_printDebug == true )
537540 {
538- debug. print (" Sending: " );
541+ _debugSerial-> print (" Sending: " );
539542 printPacket (&outgoingUBX);
540543 }
541544 if (commType == COMM_TYPE_I2C)
@@ -697,23 +700,23 @@ void SFE_UBLOX_GPS::printPacket(ubxPacket *packet)
697700{
698701 if (_printDebug == true )
699702 {
700- debug. print (" CLS:" );
701- debug. print (packet->cls , HEX);
703+ _debugSerial-> print (" CLS:" );
704+ _debugSerial-> print (packet->cls , HEX);
702705
703- debug. print (" ID:" );
704- debug. print (packet->id , HEX);
706+ _debugSerial-> print (" ID:" );
707+ _debugSerial-> print (packet->id , HEX);
705708
706- // debug. print(" Len: 0x");
707- // debug. print(packet->len, HEX);
709+ // _debugSerial-> print(" Len: 0x");
710+ // _debugSerial-> print(packet->len, HEX);
708711
709- debug. print (" Payload:" );
712+ _debugSerial-> print (" Payload:" );
710713
711714 for (int x = 0 ; x < packet->len ; x++)
712715 {
713- debug. print (" " );
714- debug. print (packet->payload [x], HEX);
716+ _debugSerial-> print (" " );
717+ _debugSerial-> print (packet->payload [x], HEX);
715718 }
716- debug. println ();
719+ _debugSerial-> println ();
717720 }
718721}
719722
@@ -740,15 +743,15 @@ boolean SFE_UBLOX_GPS::waitForResponse(uint8_t requestedClass, uint8_t requested
740743 {
741744 if (_printDebug == true )
742745 {
743- debug. println (F (" CLS/ID match!" ));
746+ _debugSerial-> println (F (" CLS/ID match!" ));
744747 }
745748 return (true ); // If the packet we just sent was a NAV packet then we'll just get data back
746749 }
747- if (_printDebug == true )
750+ else
748751 {
749- else
752+ if (_printDebug == true )
750753 {
751- debug. print (F (" Packet didn't match CLS/ID" ));
754+ _debugSerial-> print (F (" Packet didn't match CLS/ID" ));
752755 printPacket (&packetCfg);
753756 }
754757 }
@@ -759,7 +762,7 @@ boolean SFE_UBLOX_GPS::waitForResponse(uint8_t requestedClass, uint8_t requested
759762
760763 if (_printDebug == true )
761764 {
762- debug. println (F (" waitForResponse timeout" ));
765+ _debugSerial-> println (F (" waitForResponse timeout" ));
763766 }
764767
765768 return (false );
@@ -832,9 +835,9 @@ uint8_t SFE_UBLOX_GPS::getVal(uint16_t group, uint16_t id, uint8_t size, uint8_t
832835
833836 if (_printDebug == true )
834837 {
835- debug. print (" key: 0x" );
836- debug. print (key, HEX);
837- debug. println ();
838+ _debugSerial-> print (" key: 0x" );
839+ _debugSerial-> print (key, HEX);
840+ _debugSerial-> println ();
838841 }
839842
840843 // Load key into outgoing payload
@@ -849,9 +852,9 @@ uint8_t SFE_UBLOX_GPS::getVal(uint16_t group, uint16_t id, uint8_t size, uint8_t
849852
850853 if (_printDebug == true )
851854 {
852- debug. print (" response (should be 0x01): 0x" );
853- debug. print (payloadCfg[0 ], HEX);
854- debug. println ();
855+ _debugSerial-> print (" response (should be 0x01): 0x" );
856+ _debugSerial-> print (payloadCfg[0 ], HEX);
857+ _debugSerial-> println ();
855858 }
856859
857860 // Pull the requested value from the response
@@ -1349,17 +1352,18 @@ boolean SFE_UBLOX_GPS::getProtocolVersion(uint16_t maxWait)
13491352
13501353 if (_printDebug == true )
13511354 {
1352- debug. print (" Extension " );
1353- debug. print (extensionNumber);
1354- debug. print (" : " );
1355+ _debugSerial-> print (" Extension " );
1356+ _debugSerial-> print (extensionNumber);
1357+ _debugSerial-> print (" : " );
13551358 for (int location = 0 ; location < MAX_PAYLOAD_SIZE; location++)
13561359 {
13571360 if (payloadCfg[location] == ' \0 ' )
13581361 break ;
1359- debug. write (payloadCfg[location]);
1362+ _debugSerial-> write (payloadCfg[location]);
13601363 }
1361- debug. println ();
1364+ _debugSerial-> println ();
13621365 }
1366+
13631367 // Now we need to find "PROTVER=18.00" in the incoming byte stream
13641368 if (payloadCfg[0 ] == ' P' && payloadCfg[6 ] == ' R' )
13651369 {
0 commit comments