Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit bf7336f

Browse files
author
Nathan Seidle
committed
Change serial debugs from Serial to _debugSerial from PR19
1 parent d44c319 commit bf7336f

File tree

1 file changed

+57
-33
lines changed

1 file changed

+57
-33
lines changed

src/SparkFun_Ublox_Arduino_Library.cpp

+57-33
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,14 @@ void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
405405
{
406406
//Radio.sendReliable((String)incoming); //An example of passing this byte to a radio
407407

408-
//Serial.write(incoming); //An example of passing this byte out the serial port
408+
//_debugSerial->write(incoming); //An example of passing this byte out the serial port
409409

410410
//Debug printing
411-
// Serial.print(" ");
412-
// if(incoming < 0x10) Serial.print("0");
413-
// if(incoming < 0x10) Serial.print("0");
414-
// Serial.print(incoming, HEX);
415-
// if(rtcmFrameCounter % 16 == 0) Serial.println();
411+
// _debugSerial->print(" ");
412+
// if(incoming < 0x10) _debugSerial->print("0");
413+
// if(incoming < 0x10) _debugSerial->print("0");
414+
// _debugSerial->print(incoming, HEX);
415+
// if(rtcmFrameCounter % 16 == 0) _debugSerial->println();
416416
}
417417

418418
//Given a character, file it away into the uxb packet structure
@@ -552,7 +552,8 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
552552
moduleQueried.headingOfMotion = true;
553553
moduleQueried.pDOP = true;
554554
}
555-
else if (msg->id == UBX_NAV_HPPOSLLH && msg->len == 36){
555+
else if (msg->id == UBX_NAV_HPPOSLLH && msg->len == 36)
556+
{
556557
timeOfWeek = extractLong(4);
557558
highResLatitude = extractLong(8);
558559
highResLongitude = extractLong(12);
@@ -561,7 +562,7 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
561562
geoidSeparation = extractLong(24);
562563
horizontalAccuracy = extractLong(28);
563564
verticalAccuracy = extractLong(32);
564-
565+
565566
highResModuleQueried.all = true;
566567
highResModuleQueried.timeOfWeek = true;
567568
highResModuleQueried.highResLatitude = true;
@@ -574,14 +575,30 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
574575

575576
if (_printDebug == true)
576577
{
577-
Serial.print("Sec: "); Serial.print(((float)extractLong(4)) / 1000.0f); Serial.print(" ");
578-
Serial.print("LON: "); Serial.print(((float)(int32_t)extractLong(8)) / 10000000.0f); Serial.print(" ");
579-
Serial.print("LAT: "); Serial.print(((float)(int32_t)extractLong(12)) / 10000000.0f); Serial.print(" ");
580-
Serial.print("ELI M: "); Serial.print(((float)(int32_t)extractLong(16)) / 1000.0f); Serial.print(" ");
581-
Serial.print("MSL M: "); Serial.print(((float)(int32_t)extractLong(20)) / 1000.0f); Serial.print(" ");
582-
Serial.print("GEO: "); Serial.print(((float)(int32_t)extractLong(24))/ 1000.0f); Serial.print(" ");
583-
Serial.print("HA 2D M: "); Serial.print(((float)extractLong(28)) / 1000.0f); Serial.print(" ");
584-
Serial.print("VERT M: "); Serial.print(((float)extractLong(32)) / 1000.0f); Serial.print(" ");
578+
_debugSerial->print("Sec: ");
579+
_debugSerial->print(((float)extractLong(4)) / 1000.0f);
580+
_debugSerial->print(" ");
581+
_debugSerial->print("LON: ");
582+
_debugSerial->print(((float)(int32_t)extractLong(8)) / 10000000.0f);
583+
_debugSerial->print(" ");
584+
_debugSerial->print("LAT: ");
585+
_debugSerial->print(((float)(int32_t)extractLong(12)) / 10000000.0f);
586+
_debugSerial->print(" ");
587+
_debugSerial->print("ELI M: ");
588+
_debugSerial->print(((float)(int32_t)extractLong(16)) / 1000.0f);
589+
_debugSerial->print(" ");
590+
_debugSerial->print("MSL M: ");
591+
_debugSerial->print(((float)(int32_t)extractLong(20)) / 1000.0f);
592+
_debugSerial->print(" ");
593+
_debugSerial->print("GEO: ");
594+
_debugSerial->print(((float)(int32_t)extractLong(24)) / 1000.0f);
595+
_debugSerial->print(" ");
596+
_debugSerial->print("HA 2D M: ");
597+
_debugSerial->print(((float)extractLong(28)) / 1000.0f);
598+
_debugSerial->print(" ");
599+
_debugSerial->print("VERT M: ");
600+
_debugSerial->print(((float)extractLong(32)) / 1000.0f);
601+
_debugSerial->print(" ");
585602
}
586603
}
587604
break;
@@ -1339,56 +1356,64 @@ boolean SFE_UBLOX_GPS::getPVT(uint16_t maxWait)
13391356
}
13401357
}
13411358

1342-
uint32_t SFE_UBLOX_GPS::getTimeOfWeek(uint16_t maxWait/* = 250*/){
1359+
uint32_t SFE_UBLOX_GPS::getTimeOfWeek(uint16_t maxWait /* = 250*/)
1360+
{
13431361
if (highResModuleQueried.timeOfWeek == false)
13441362
getHPPOSLLH();
13451363
highResModuleQueried.timeOfWeek = false; //Since we are about to give this to user, mark this data as stale
13461364
return (timeOfWeek);
13471365
}
13481366

1349-
int32_t SFE_UBLOX_GPS::getHighResLatitude(uint16_t maxWait/* = 250*/){
1367+
int32_t SFE_UBLOX_GPS::getHighResLatitude(uint16_t maxWait /* = 250*/)
1368+
{
13501369
if (highResModuleQueried.highResLatitude == false)
13511370
getHPPOSLLH();
13521371
highResModuleQueried.highResLatitude = false; //Since we are about to give this to user, mark this data as stale
13531372
return (highResLatitude);
13541373
}
13551374

1356-
int32_t SFE_UBLOX_GPS::getHighResLongitude(uint16_t maxWait/* = 250*/){
1375+
int32_t SFE_UBLOX_GPS::getHighResLongitude(uint16_t maxWait /* = 250*/)
1376+
{
13571377
if (highResModuleQueried.highResLongitude == false)
13581378
getHPPOSLLH();
13591379
highResModuleQueried.highResLongitude = false; //Since we are about to give this to user, mark this data as stale
13601380
return (highResLongitude);
13611381
}
13621382

1363-
int32_t SFE_UBLOX_GPS::getElipsoid(uint16_t maxWait/* = 250*/){
1383+
int32_t SFE_UBLOX_GPS::getElipsoid(uint16_t maxWait /* = 250*/)
1384+
{
13641385
if (highResModuleQueried.elipsoid == false)
13651386
getHPPOSLLH();
13661387
highResModuleQueried.elipsoid = false; //Since we are about to give this to user, mark this data as stale
13671388
return (elipsoid);
13681389
}
13691390

1370-
int32_t SFE_UBLOX_GPS::getMeanSeaLevel(uint16_t maxWait/* = 250*/){
1391+
int32_t SFE_UBLOX_GPS::getMeanSeaLevel(uint16_t maxWait /* = 250*/)
1392+
{
13711393
if (highResModuleQueried.meanSeaLevel == false)
13721394
getHPPOSLLH();
13731395
highResModuleQueried.meanSeaLevel = false; //Since we are about to give this to user, mark this data as stale
13741396
return (meanSeaLevel);
13751397
}
13761398

1377-
int32_t SFE_UBLOX_GPS::getGeoidSeparation(uint16_t maxWait/* = 250*/){
1399+
int32_t SFE_UBLOX_GPS::getGeoidSeparation(uint16_t maxWait /* = 250*/)
1400+
{
13781401
if (highResModuleQueried.geoidSeparation == false)
13791402
getHPPOSLLH();
13801403
highResModuleQueried.geoidSeparation = false; //Since we are about to give this to user, mark this data as stale
13811404
return (geoidSeparation);
13821405
}
13831406

1384-
uint32_t SFE_UBLOX_GPS::getHorizontalAccuracy(uint16_t maxWait/* = 250*/){
1407+
uint32_t SFE_UBLOX_GPS::getHorizontalAccuracy(uint16_t maxWait /* = 250*/)
1408+
{
13851409
if (highResModuleQueried.horizontalAccuracy == false)
13861410
getHPPOSLLH();
13871411
highResModuleQueried.horizontalAccuracy = false; //Since we are about to give this to user, mark this data as stale
13881412
return (horizontalAccuracy);
13891413
}
13901414

1391-
uint32_t SFE_UBLOX_GPS::getVerticalAccuracy(uint16_t maxWait/* = 250*/){
1415+
uint32_t SFE_UBLOX_GPS::getVerticalAccuracy(uint16_t maxWait /* = 250*/)
1416+
{
13921417
if (highResModuleQueried.verticalAccuracy == false)
13931418
getHPPOSLLH();
13941419
highResModuleQueried.verticalAccuracy = false; //Since we are about to give this to user, mark this data as stale
@@ -1397,16 +1422,15 @@ uint32_t SFE_UBLOX_GPS::getVerticalAccuracy(uint16_t maxWait/* = 250*/){
13971422

13981423
boolean SFE_UBLOX_GPS::getHPPOSLLH(uint16_t maxWait)
13991424
{
1400-
//The GPS is not automatically reporting navigation position so we have to poll explicitly
1401-
packetCfg.cls = UBX_CLASS_NAV;
1402-
packetCfg.id = UBX_NAV_HPPOSLLH;
1403-
packetCfg.len = 0;
1425+
//The GPS is not automatically reporting navigation position so we have to poll explicitly
1426+
packetCfg.cls = UBX_CLASS_NAV;
1427+
packetCfg.id = UBX_NAV_HPPOSLLH;
1428+
packetCfg.len = 0;
14041429

1405-
return sendCommand(packetCfg, maxWait);
1406-
return (false); //If command send fails then bail
1430+
return sendCommand(packetCfg, maxWait);
1431+
return (false); //If command send fails then bail
14071432
}
14081433

1409-
14101434
//Get the current 3D high precision positional accuracy - a fun thing to watch
14111435
//Returns a long representing the 3D accuracy in millimeters
14121436
uint32_t SFE_UBLOX_GPS::getPositionAccuracy(uint16_t maxWait)
@@ -1624,8 +1648,8 @@ boolean SFE_UBLOX_GPS::getRELPOSNED(uint16_t maxWait)
16241648
//We got a response, now parse the bits
16251649

16261650
uint16_t refStationID = extractInt(2);
1627-
Serial.print("refStationID: ");
1628-
Serial.println(refStationID);
1651+
//_debugSerial->print("refStationID: ");
1652+
//_debugSerial->println(refStationID);
16291653

16301654
int32_t tempRelPos;
16311655

0 commit comments

Comments
 (0)