Skip to content

Commit 28c71ae

Browse files
committed
Change maxNMEAByteCount to 88. Add set/getMaxNMEAByteCount
1 parent 81003bf commit 28c71ae

3 files changed

+27
-3
lines changed

Diff for: keywords.txt

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ setI2CTransactionSize KEYWORD2
5757
getI2CTransactionSize KEYWORD2
5858
setSpiTransactionSize KEYWORD2
5959
getSpiTransactionSize KEYWORD2
60+
setMaxNMEAByteCount KEYWORD2
61+
getMaxNMEAByteCount KEYWORD2
6062
isConnected KEYWORD2
6163
enableDebugging KEYWORD2
6264
disableDebugging KEYWORD2

Diff for: src/SparkFun_u-blox_GNSS_Arduino_Library.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,16 @@ uint8_t SFE_UBLOX_GNSS::getSpiTransactionSize(void)
550550
return (spiTransactionSize);
551551
}
552552

553+
//Sets the size of maxNMEAByteCount
554+
void SFE_UBLOX_GNSS::setMaxNMEAByteCount(int8_t newMax)
555+
{
556+
maxNMEAByteCount = newMax;
557+
}
558+
int8_t SFE_UBLOX_GNSS::getMaxNMEAByteCount(void)
559+
{
560+
return (maxNMEAByteCount);
561+
}
562+
553563
//Returns true if I2C device ack's
554564
boolean SFE_UBLOX_GNSS::isConnected(uint16_t maxWait)
555565
{

Diff for: src/SparkFun_u-blox_GNSS_Arduino_Library.h

+15-3
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,12 @@ enum sfe_ublox_ls_src_e
497497
// For storing SPI bytes received during sendSpiCommand
498498
#define SFE_UBLOX_SPI_BUFFER_SIZE 128
499499

500+
// Default maximum NMEA byte count
501+
// maxNMEAByteCount was set to 82: https://en.wikipedia.org/wiki/NMEA_0183#Message_structure
502+
// but the u-blox HP (RTK) GGA messages are 88 bytes long
503+
// The user can adjust maxNMEAByteCount by calling setMaxNMEAByteCount
504+
#define SFE_UBLOX_MAX_NMEA_BYTE_COUNT 88
505+
500506
//-=-=-=-=- UBX binary specific variables
501507
struct ubxPacket
502508
{
@@ -572,6 +578,9 @@ class SFE_UBLOX_GNSS
572578

573579
void setI2CpollingWait(uint8_t newPollingWait_ms); // Allow the user to change the I2C polling wait if required
574580

581+
//Set the max number of bytes set in a given I2C transaction
582+
uint8_t i2cTransactionSize = 32; //Default to ATmega328 limit
583+
575584
//Control the size of the internal I2C transaction amount
576585
void setI2CTransactionSize(uint8_t bufferSize);
577586
uint8_t getI2CTransactionSize(void);
@@ -581,8 +590,9 @@ class SFE_UBLOX_GNSS
581590
void setSpiTransactionSize(uint8_t bufferSize);
582591
uint8_t getSpiTransactionSize(void);
583592

584-
//Set the max number of bytes set in a given I2C transaction
585-
uint8_t i2cTransactionSize = 32; //Default to ATmega328 limit
593+
//Control the size of maxNMEAByteCount
594+
void setMaxNMEAByteCount(int8_t newMax);
595+
int8_t getMaxNMEAByteCount(void);
586596

587597
//Returns true if device answers on _gpsI2Caddress address or via Serial
588598
boolean isConnected(uint16_t maxWait = 1100);
@@ -1345,7 +1355,9 @@ class SFE_UBLOX_GNSS
13451355
uint8_t rollingChecksumB; //Rolls forward as we receive incoming bytes. Checked against the last two A/B checksum bytes
13461356

13471357
int8_t nmeaByteCounter; //Count all NMEA message bytes.
1348-
const int8_t maxNMEAByteCount = 82; // Abort NMEA message reception if nmeaByteCounter exceeds this (https://en.wikipedia.org/wiki/NMEA_0183#Message_structure)
1358+
// Abort NMEA message reception if nmeaByteCounter exceeds maxNMEAByteCount.
1359+
// The user can adjust maxNMEAByteCount by calling setMaxNMEAByteCount
1360+
int8_t maxNMEAByteCount = SFE_UBLOX_MAX_NMEA_BYTE_COUNT;
13491361
uint8_t nmeaAddressField[6]; // NMEA Address Field - includes the start character (*)
13501362
boolean logThisNMEA(); // Return true if we should log this NMEA message
13511363
boolean processThisNMEA(); // Return true if we should pass this NMEA message to processNMEA

0 commit comments

Comments
 (0)