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

Commit 4eadbe2

Browse files
committed
Created checkUbloxInternal. Corrected checkUblox.
1 parent 17b19df commit 4eadbe2

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

Diff for: src/SparkFun_Ublox_Arduino_Library.cpp

+11-5
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,13 @@ void SFE_UBLOX_GPS::setNMEAOutputPort(Stream &nmeaOutputPort)
266266
}
267267

268268
//Called regularly to check for available bytes on the user' specified port
269-
boolean SFE_UBLOX_GPS::checkUblox(ubxPacket *incomingUBX, uint8_t requestedClass, uint8_t requestedID)
269+
boolean SFE_UBLOX_GPS::checkUblox(uint8_t requestedClass, uint8_t requestedID)
270+
{
271+
return checkUbloxInternal(&packetCfg, requestedClass, requestedID);
272+
}
273+
274+
//Called regularly to check for available bytes on the user' specified port
275+
boolean SFE_UBLOX_GPS::checkUbloxInternal(ubxPacket *incomingUBX, uint8_t requestedClass, uint8_t requestedID)
270276
{
271277
if (commType == COMM_TYPE_I2C)
272278
return (checkUbloxI2C(incomingUBX, requestedClass, requestedID));
@@ -1289,7 +1295,7 @@ sfe_ublox_status_e SFE_UBLOX_GPS::waitForACKResponse(ubxPacket *outgoingUBX, uin
12891295
unsigned long startTime = millis();
12901296
while (millis() - startTime < maxTime)
12911297
{
1292-
if (checkUblox(outgoingUBX, requestedClass, requestedID) == true) //See if new data is available. Process bytes as they come in.
1298+
if (checkUbloxInternal(outgoingUBX, requestedClass, requestedID) == true) //See if new data is available. Process bytes as they come in.
12931299
{
12941300
// If both the outgoingUBX->classAndIDmatch and packetAck.classAndIDmatch are VALID
12951301
// and outgoingUBX->valid is _still_ VALID and the class and ID _still_ match
@@ -1425,7 +1431,7 @@ sfe_ublox_status_e SFE_UBLOX_GPS::waitForACKResponse(ubxPacket *outgoingUBX, uin
14251431
}
14261432
}
14271433

1428-
} //checkUblox == true
1434+
} //checkUbloxInternal == true
14291435

14301436
delayMicroseconds(500);
14311437
} //while (millis() - startTime < maxTime)
@@ -1476,7 +1482,7 @@ sfe_ublox_status_e SFE_UBLOX_GPS::waitForNoACKResponse(ubxPacket *outgoingUBX, u
14761482
unsigned long startTime = millis();
14771483
while (millis() - startTime < maxTime)
14781484
{
1479-
if (checkUblox(outgoingUBX, requestedClass, requestedID) == true) //See if new data is available. Process bytes as they come in.
1485+
if (checkUbloxInternal(outgoingUBX, requestedClass, requestedID) == true) //See if new data is available. Process bytes as they come in.
14801486
{
14811487

14821488
// If outgoingUBX->classAndIDmatch is VALID
@@ -2718,7 +2724,7 @@ boolean SFE_UBLOX_GPS::getPVT(uint16_t maxWait)
27182724
{
27192725
_debugSerial->println(F("getPVT: Autoreporting"));
27202726
}
2721-
checkUblox(&packetCfg, UBX_CLASS_NAV, UBX_NAV_PVT);
2727+
checkUbloxInternal(&packetCfg, UBX_CLASS_NAV, UBX_NAV_PVT);
27222728
return moduleQueried.all;
27232729
}
27242730
else if (autoPVT && !autoPVTImplicitUpdate)

Diff for: src/SparkFun_Ublox_Arduino_Library.h

+9-5
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,15 @@ class SFE_UBLOX_GPS
462462
//maxWait is only used for Serial
463463
boolean isConnected(uint16_t maxWait = 1100);
464464

465-
boolean checkUblox(ubxPacket *incomingUBX, uint8_t requestedClass = 255, uint8_t requestedID = 255); //Checks module with user selected commType
466-
boolean checkUbloxI2C(ubxPacket *incomingUBX, uint8_t requestedClass = 255, uint8_t requestedID = 255); //Method for I2C polling of data, passing any new bytes to process()
467-
boolean checkUbloxSerial(ubxPacket *incomingUBX, uint8_t requestedClass = 255, uint8_t requestedID = 255); //Method for serial polling of data, passing any new bytes to process()
465+
//Changed in V1.8.1: provides backward compatibility for the examples that call checkUblox directly
466+
//Will default to using packetCfg to look for explicit autoPVT packets so they get processed correctly by processUBX
467+
boolean checkUblox(uint8_t requestedClass = UBX_CLASS_NAV, uint8_t requestedID = UBX_NAV_PVT); //Checks module with user selected commType
468468

469-
void process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t requestedClass = 255, uint8_t requestedID = 255); //Processes NMEA and UBX binary sentences one byte at a time
470-
void processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_t requestedClass = 255, uint8_t requestedID = 255); //Given a character, file it away into the uxb packet structure
469+
boolean checkUbloxI2C(ubxPacket *incomingUBX, uint8_t requestedClass, uint8_t requestedID); //Method for I2C polling of data, passing any new bytes to process()
470+
boolean checkUbloxSerial(ubxPacket *incomingUBX, uint8_t requestedClass, uint8_t requestedID); //Method for serial polling of data, passing any new bytes to process()
471+
472+
void process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t requestedClass, uint8_t requestedID); //Processes NMEA and UBX binary sentences one byte at a time
473+
void processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_t requestedClass, uint8_t requestedID); //Given a character, file it away into the uxb packet structure
471474
void processRTCMframe(uint8_t incoming); //Monitor the incoming bytes for start and length bytes
472475
void processRTCM(uint8_t incoming) __attribute__((weak)); //Given rtcm byte, do something with it. User can overwrite if desired to pipe bytes to radio, internet, etc.
473476

@@ -723,6 +726,7 @@ class SFE_UBLOX_GPS
723726
} commType = COMM_TYPE_I2C; //Controls which port we look to for incoming bytes
724727

725728
//Functions
729+
boolean checkUbloxInternal(ubxPacket *incomingUBX, uint8_t requestedClass = 255, uint8_t requestedID = 255); //Checks module with user selected commType
726730
uint32_t extractLong(uint8_t spotToStart); //Combine four bytes from payload into long
727731
uint16_t extractInt(uint8_t spotToStart); //Combine two bytes from payload into int
728732
uint8_t extractByte(uint8_t spotToStart); //Get byte from payload

0 commit comments

Comments
 (0)