@@ -63,13 +63,13 @@ boolean SFE_UBLOX_GPS::begin(Stream &serialPort)
63
63
64
64
// Enable or disable the printing of sent/response HEX values.
65
65
// 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)
67
67
{
68
68
_debugSerial = &debugPort; // Grab which port the user wants us to use for debugging
69
69
70
70
_printDebug = true ; // Should we print the commands we send? Good for debugging
71
71
}
72
- void RFID ::disableDebugging (void )
72
+ void SFE_UBLOX_GPS ::disableDebugging (void )
73
73
{
74
74
_printDebug = false ; // Turn off extra print statements
75
75
}
@@ -115,8 +115,8 @@ void SFE_UBLOX_GPS::setSerialRate(uint32_t baudrate, uint8_t uartPort, uint16_t
115
115
116
116
if (_printDebug == true )
117
117
{
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 ]);
120
120
}
121
121
122
122
packetCfg.cls = UBX_CLASS_CFG;
@@ -132,8 +132,8 @@ void SFE_UBLOX_GPS::setSerialRate(uint32_t baudrate, uint8_t uartPort, uint16_t
132
132
133
133
if (_printDebug == true )
134
134
{
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 ]);
137
137
}
138
138
139
139
sendCommand (packetCfg);
@@ -203,7 +203,7 @@ boolean SFE_UBLOX_GPS::checkUbloxI2C()
203
203
{
204
204
if (_printDebug == true )
205
205
{
206
- debug. println (" No bytes available" );
206
+ _debugSerial-> println (" No bytes available" );
207
207
}
208
208
lastCheck = millis (); // Put off checking to avoid I2C bus traffic
209
209
return true ;
@@ -259,10 +259,10 @@ void SFE_UBLOX_GPS::process(uint8_t incoming)
259
259
if (_printDebug == true )
260
260
{
261
261
// 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
263
263
264
- // debug. print(" ");
265
- // debug. print(incoming, HEX);
264
+ // _debugSerial-> print(" ");
265
+ // _debugSerial-> print(incoming, HEX);
266
266
}
267
267
268
268
if (currentSentence == NONE || currentSentence == NMEA)
@@ -447,15 +447,18 @@ void SFE_UBLOX_GPS::processUBX(uint8_t incoming, ubxPacket *incomingUBX)
447
447
{
448
448
if (_printDebug == true )
449
449
{
450
- debug. print (" Received: " );
450
+ _debugSerial-> print (" Received: " );
451
451
printPacket (incomingUBX);
452
452
}
453
453
incomingUBX->valid = true ;
454
454
processUBXpacket (incomingUBX); // We've got a valid packet, now do something with it
455
455
}
456
- if (_printDebug == true )
456
+ else
457
457
{
458
- else debug.println (" Checksum failed. Response too big?" );
458
+ if (_printDebug == true )
459
+ {
460
+ _debugSerial->println (" Checksum failed. Response too big?" );
461
+ }
459
462
}
460
463
}
461
464
else // Load this byte into the payload array
@@ -488,7 +491,7 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
488
491
// The ack we just received matched the CLS/ID of last packetCfg sent
489
492
if (_printDebug == true )
490
493
{
491
- debug. println (" Command sent/ack'd successfully" );
494
+ _debugSerial-> println (" Command sent/ack'd successfully" );
492
495
}
493
496
commandAck = true ;
494
497
}
@@ -535,7 +538,7 @@ boolean SFE_UBLOX_GPS::sendCommand(ubxPacket outgoingUBX, uint16_t maxWait)
535
538
536
539
if (_printDebug == true )
537
540
{
538
- debug. print (" Sending: " );
541
+ _debugSerial-> print (" Sending: " );
539
542
printPacket (&outgoingUBX);
540
543
}
541
544
if (commType == COMM_TYPE_I2C)
@@ -697,23 +700,23 @@ void SFE_UBLOX_GPS::printPacket(ubxPacket *packet)
697
700
{
698
701
if (_printDebug == true )
699
702
{
700
- debug. print (" CLS:" );
701
- debug. print (packet->cls , HEX);
703
+ _debugSerial-> print (" CLS:" );
704
+ _debugSerial-> print (packet->cls , HEX);
702
705
703
- debug. print (" ID:" );
704
- debug. print (packet->id , HEX);
706
+ _debugSerial-> print (" ID:" );
707
+ _debugSerial-> print (packet->id , HEX);
705
708
706
- // debug. print(" Len: 0x");
707
- // debug. print(packet->len, HEX);
709
+ // _debugSerial-> print(" Len: 0x");
710
+ // _debugSerial-> print(packet->len, HEX);
708
711
709
- debug. print (" Payload:" );
712
+ _debugSerial-> print (" Payload:" );
710
713
711
714
for (int x = 0 ; x < packet->len ; x++)
712
715
{
713
- debug. print (" " );
714
- debug. print (packet->payload [x], HEX);
716
+ _debugSerial-> print (" " );
717
+ _debugSerial-> print (packet->payload [x], HEX);
715
718
}
716
- debug. println ();
719
+ _debugSerial-> println ();
717
720
}
718
721
}
719
722
@@ -740,15 +743,15 @@ boolean SFE_UBLOX_GPS::waitForResponse(uint8_t requestedClass, uint8_t requested
740
743
{
741
744
if (_printDebug == true )
742
745
{
743
- debug. println (F (" CLS/ID match!" ));
746
+ _debugSerial-> println (F (" CLS/ID match!" ));
744
747
}
745
748
return (true ); // If the packet we just sent was a NAV packet then we'll just get data back
746
749
}
747
- if (_printDebug == true )
750
+ else
748
751
{
749
- else
752
+ if (_printDebug == true )
750
753
{
751
- debug. print (F (" Packet didn't match CLS/ID" ));
754
+ _debugSerial-> print (F (" Packet didn't match CLS/ID" ));
752
755
printPacket (&packetCfg);
753
756
}
754
757
}
@@ -759,7 +762,7 @@ boolean SFE_UBLOX_GPS::waitForResponse(uint8_t requestedClass, uint8_t requested
759
762
760
763
if (_printDebug == true )
761
764
{
762
- debug. println (F (" waitForResponse timeout" ));
765
+ _debugSerial-> println (F (" waitForResponse timeout" ));
763
766
}
764
767
765
768
return (false );
@@ -832,9 +835,9 @@ uint8_t SFE_UBLOX_GPS::getVal(uint16_t group, uint16_t id, uint8_t size, uint8_t
832
835
833
836
if (_printDebug == true )
834
837
{
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 ();
838
841
}
839
842
840
843
// 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
849
852
850
853
if (_printDebug == true )
851
854
{
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 ();
855
858
}
856
859
857
860
// Pull the requested value from the response
@@ -1349,17 +1352,18 @@ boolean SFE_UBLOX_GPS::getProtocolVersion(uint16_t maxWait)
1349
1352
1350
1353
if (_printDebug == true )
1351
1354
{
1352
- debug. print (" Extension " );
1353
- debug. print (extensionNumber);
1354
- debug. print (" : " );
1355
+ _debugSerial-> print (" Extension " );
1356
+ _debugSerial-> print (extensionNumber);
1357
+ _debugSerial-> print (" : " );
1355
1358
for (int location = 0 ; location < MAX_PAYLOAD_SIZE; location++)
1356
1359
{
1357
1360
if (payloadCfg[location] == ' \0 ' )
1358
1361
break ;
1359
- debug. write (payloadCfg[location]);
1362
+ _debugSerial-> write (payloadCfg[location]);
1360
1363
}
1361
- debug. println ();
1364
+ _debugSerial-> println ();
1362
1365
}
1366
+
1363
1367
// Now we need to find "PROTVER=18.00" in the incoming byte stream
1364
1368
if (payloadCfg[0 ] == ' P' && payloadCfg[6 ] == ' R' )
1365
1369
{
0 commit comments