Disable auto-NMEA support on the Uno - to avoid exceeding the program memory
This commit is contained in:
@@ -422,6 +422,7 @@ void SFE_UBLOX_GNSS::end(void)
|
|||||||
packetUBXHNRPVT = NULL; // Redundant?
|
packetUBXHNRPVT = NULL; // Redundant?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
if (storageNMEAGPGGA != NULL)
|
if (storageNMEAGPGGA != NULL)
|
||||||
{
|
{
|
||||||
if (storageNMEAGPGGA->callbackCopy != NULL)
|
if (storageNMEAGPGGA->callbackCopy != NULL)
|
||||||
@@ -501,6 +502,7 @@ void SFE_UBLOX_GNSS::end(void)
|
|||||||
delete storageNMEAGNZDA;
|
delete storageNMEAGNZDA;
|
||||||
storageNMEAGNZDA = NULL; // Redundant?
|
storageNMEAGNZDA = NULL; // Redundant?
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow the user to change packetCfgPayloadSize. Handy if you want to process big messages like RAWX
|
// Allow the user to change packetCfgPayloadSize. Handy if you want to process big messages like RAWX
|
||||||
@@ -1861,6 +1863,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
|
|||||||
_signsOfLife = isNMEAHeaderValid();
|
_signsOfLife = isNMEAHeaderValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
// Check if we have automatic storage for this message
|
// Check if we have automatic storage for this message
|
||||||
if (isThisNMEAauto())
|
if (isThisNMEAauto())
|
||||||
{
|
{
|
||||||
@@ -1872,6 +1875,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
|
|||||||
memcpy(nmeaPtr, &nmeaAddressField[0], 6); // Copy the start character and address field into the working copy
|
memcpy(nmeaPtr, &nmeaAddressField[0], 6); // Copy the start character and address field into the working copy
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
// if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
// {
|
// {
|
||||||
@@ -1898,6 +1902,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
|
|||||||
|
|
||||||
if ((nmeaByteCounter > 5) || (nmeaByteCounter < 0)) // Should we add incoming to the file buffer and/or pass it to processNMEA?
|
if ((nmeaByteCounter > 5) || (nmeaByteCounter < 0)) // Should we add incoming to the file buffer and/or pass it to processNMEA?
|
||||||
{
|
{
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
if (isThisNMEAauto())
|
if (isThisNMEAauto())
|
||||||
{
|
{
|
||||||
uint8_t *lengthPtr = getNMEAWorkingLengthPtr(); // Get a pointer to the working copy length
|
uint8_t *lengthPtr = getNMEAWorkingLengthPtr(); // Get a pointer to the working copy length
|
||||||
@@ -1909,15 +1914,14 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
|
|||||||
*lengthPtr = *lengthPtr + 1; // Increment the length
|
*lengthPtr = *lengthPtr + 1; // Increment the length
|
||||||
if (*lengthPtr == nmeaMaxLength)
|
if (*lengthPtr == nmeaMaxLength)
|
||||||
{
|
{
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
|
||||||
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
{
|
{
|
||||||
_debugSerial->println(F("process: NMEA buffer is full!"));
|
_debugSerial->println(F("process: NMEA buffer is full!"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (logThisNMEA())
|
if (logThisNMEA())
|
||||||
storeFileBytes(&incoming, 1); // Add incoming to the file buffer
|
storeFileBytes(&incoming, 1); // Add incoming to the file buffer
|
||||||
if (processThisNMEA())
|
if (processThisNMEA())
|
||||||
@@ -1934,6 +1938,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
|
|||||||
|
|
||||||
if (nmeaByteCounter == 0) // Check if we are done
|
if (nmeaByteCounter == 0) // Check if we are done
|
||||||
{
|
{
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
if (isThisNMEAauto())
|
if (isThisNMEAauto())
|
||||||
{
|
{
|
||||||
uint8_t *workingLengthPtr = getNMEAWorkingLengthPtr(); // Get a pointer to the working copy length
|
uint8_t *workingLengthPtr = getNMEAWorkingLengthPtr(); // Get a pointer to the working copy length
|
||||||
@@ -1988,7 +1993,6 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
|
||||||
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
{
|
{
|
||||||
_debugSerial->print(F("process: NMEA checksum fail (2)! Expected "));
|
_debugSerial->print(F("process: NMEA checksum fail (2)! Expected "));
|
||||||
@@ -1999,19 +2003,17 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
|
|||||||
_debugSerial->write(*(workingNMEAPtr + charsChecked + 1));
|
_debugSerial->write(*(workingNMEAPtr + charsChecked + 1));
|
||||||
_debugSerial->println();
|
_debugSerial->println();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
|
||||||
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
{
|
{
|
||||||
_debugSerial->println(F("process: NMEA checksum fail (1)!"));
|
_debugSerial->println(F("process: NMEA checksum fail (1)!"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
|
||||||
currentSentence = NONE; // All done!
|
currentSentence = NONE; // All done!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2192,6 +2194,7 @@ void SFE_UBLOX_GNSS::processNMEA(char incoming)
|
|||||||
_nmeaOutputPort->write(incoming); // Echo this byte to the serial port
|
_nmeaOutputPort->write(incoming); // Echo this byte to the serial port
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
// Check if the NMEA message (in nmeaAddressField) is "auto" (i.e. has RAM allocated for it)
|
// Check if the NMEA message (in nmeaAddressField) is "auto" (i.e. has RAM allocated for it)
|
||||||
bool SFE_UBLOX_GNSS::isThisNMEAauto()
|
bool SFE_UBLOX_GNSS::isThisNMEAauto()
|
||||||
{
|
{
|
||||||
@@ -2763,6 +2766,7 @@ nmeaAutomaticFlags *SFE_UBLOX_GNSS::getNMEAFlagsPtr()
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// We need to be able to identify an RTCM packet and then the length
|
// We need to be able to identify an RTCM packet and then the length
|
||||||
// so that we know when the RTCM message is completely received and we then start
|
// so that we know when the RTCM message is completely received and we then start
|
||||||
@@ -5564,6 +5568,7 @@ void SFE_UBLOX_GNSS::checkCallbacks(void)
|
|||||||
packetUBXHNRPVT->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale
|
packetUBXHNRPVT->automaticFlags.flags.bits.callbackCopyValid = false; // Mark the data as stale
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
if ((storageNMEAGPGGA != NULL) // If RAM has been allocated for message storage
|
if ((storageNMEAGPGGA != NULL) // If RAM has been allocated for message storage
|
||||||
&& (storageNMEAGPGGA->callbackCopy != NULL) // If RAM has been allocated for the copy of the data
|
&& (storageNMEAGPGGA->callbackCopy != NULL) // If RAM has been allocated for the copy of the data
|
||||||
&& (storageNMEAGPGGA->automaticFlags.flags.bits.callbackCopyValid == 1)) // If the copy of the data is valid
|
&& (storageNMEAGPGGA->automaticFlags.flags.bits.callbackCopyValid == 1)) // If the copy of the data is valid
|
||||||
@@ -5715,6 +5720,7 @@ void SFE_UBLOX_GNSS::checkCallbacks(void)
|
|||||||
}
|
}
|
||||||
storageNMEAGNZDA->automaticFlags.flags.bits.callbackCopyValid = 0; // Mark the data as stale
|
storageNMEAGNZDA->automaticFlags.flags.bits.callbackCopyValid = 0; // Mark the data as stale
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
checkCallbacksReentrant = false;
|
checkCallbacksReentrant = false;
|
||||||
}
|
}
|
||||||
@@ -14812,6 +14818,7 @@ uint32_t SFE_UBLOX_GNSS::getProcessNMEAMask()
|
|||||||
return (_processNMEA.all);
|
return (_processNMEA.all);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
// Initiate automatic storage of NMEA GPGGA messages
|
// Initiate automatic storage of NMEA GPGGA messages
|
||||||
|
|
||||||
// Get the most recent GPGGA message
|
// Get the most recent GPGGA message
|
||||||
@@ -15234,7 +15241,7 @@ bool SFE_UBLOX_GNSS::initStorageNMEAGNVTG()
|
|||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initiate automatic storage of NMEA GPVTG messages
|
// Initiate automatic storage of NMEA GPRMC messages
|
||||||
|
|
||||||
// Get the most recent GPRMC message
|
// Get the most recent GPRMC message
|
||||||
// Return 0 if the message has not been received from the module
|
// Return 0 if the message has not been received from the module
|
||||||
@@ -15655,6 +15662,7 @@ bool SFE_UBLOX_GNSS::initStorageNMEAGNZDA()
|
|||||||
|
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// ***** CFG RATE Helper Functions
|
// ***** CFG RATE Helper Functions
|
||||||
|
|
||||||
|
|||||||
@@ -57,9 +57,9 @@
|
|||||||
#include "u-blox_structs.h"
|
#include "u-blox_structs.h"
|
||||||
|
|
||||||
// Uncomment the next line (or add SFE_UBLOX_REDUCED_PROG_MEM as a compiler directive) to reduce the amount of program memory used by the library
|
// Uncomment the next line (or add SFE_UBLOX_REDUCED_PROG_MEM as a compiler directive) to reduce the amount of program memory used by the library
|
||||||
//#define SFE_UBLOX_REDUCED_PROG_MEM // Uncommenting this line will delete the minor debug messages to save memory
|
//#define SFE_UBLOX_REDUCED_PROG_MEM // Uncommenting this line will delete the minor debug messages and disable auto-NMEA support to save memory
|
||||||
|
|
||||||
// The code just about fills the program memory on the ATmega328P (Arduino Uno), so let's delete the minor debug messages anyway
|
// The code just about fills the program memory on the ATmega328P (Arduino Uno), so let's delete the minor debug messages and disable auto-NMEA support anyway
|
||||||
#if !defined(SFE_UBLOX_REDUCED_PROG_MEM) && defined(ARDUINO_ARCH_AVR)
|
#if !defined(SFE_UBLOX_REDUCED_PROG_MEM) && defined(ARDUINO_ARCH_AVR)
|
||||||
#define SFE_UBLOX_REDUCED_PROG_MEM
|
#define SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
#endif
|
#endif
|
||||||
@@ -1431,6 +1431,7 @@ public:
|
|||||||
void setProcessNMEAMask(uint32_t messages = SFE_UBLOX_FILTER_NMEA_ALL); // Control which NMEA messages are passed to processNMEA. Default to passing ALL messages
|
void setProcessNMEAMask(uint32_t messages = SFE_UBLOX_FILTER_NMEA_ALL); // Control which NMEA messages are passed to processNMEA. Default to passing ALL messages
|
||||||
uint32_t getProcessNMEAMask(); // Return which NMEA messages are passed to processNMEA
|
uint32_t getProcessNMEAMask(); // Return which NMEA messages are passed to processNMEA
|
||||||
|
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
// Support for "auto" storage of NMEA messages
|
// Support for "auto" storage of NMEA messages
|
||||||
uint8_t getLatestNMEAGPGGA(NMEA_GGA_data_t *data); // Return the most recent GPGGA: 0 = no data, 1 = stale data, 2 = fresh data
|
uint8_t getLatestNMEAGPGGA(NMEA_GGA_data_t *data); // Return the most recent GPGGA: 0 = no data, 1 = stale data, 2 = fresh data
|
||||||
bool setNMEAGPGGAcallback(void (*callbackPointer)(NMEA_GGA_data_t)); // Enable a callback on the arrival of a GPGGA message
|
bool setNMEAGPGGAcallback(void (*callbackPointer)(NMEA_GGA_data_t)); // Enable a callback on the arrival of a GPGGA message
|
||||||
@@ -1456,6 +1457,7 @@ public:
|
|||||||
uint8_t getLatestNMEAGNZDA(NMEA_ZDA_data_t *data); // Return the most recent GNZDA: 0 = no data, 1 = stale data, 2 = fresh data
|
uint8_t getLatestNMEAGNZDA(NMEA_ZDA_data_t *data); // Return the most recent GNZDA: 0 = no data, 1 = stale data, 2 = fresh data
|
||||||
bool setNMEAGNZDAcallback(void (*callbackPointer)(NMEA_ZDA_data_t)); // Enable a callback on the arrival of a GNZDA message
|
bool setNMEAGNZDAcallback(void (*callbackPointer)(NMEA_ZDA_data_t)); // Enable a callback on the arrival of a GNZDA message
|
||||||
bool setNMEAGNZDAcallbackPtr(void (*callbackPointerPtr)(NMEA_ZDA_data_t *)); // Enable a callback on the arrival of a GNZDA message
|
bool setNMEAGNZDAcallbackPtr(void (*callbackPointerPtr)(NMEA_ZDA_data_t *)); // Enable a callback on the arrival of a GNZDA message
|
||||||
|
#endif
|
||||||
|
|
||||||
// Functions to extract signed and unsigned 8/16/32-bit data from a ubxPacket
|
// Functions to extract signed and unsigned 8/16/32-bit data from a ubxPacket
|
||||||
// From v2.0: These are public. The user can call these to extract data from custom packets
|
// From v2.0: These are public. The user can call these to extract data from custom packets
|
||||||
@@ -1511,6 +1513,7 @@ public:
|
|||||||
UBX_MGA_ACK_DATA0_t *packetUBXMGAACK = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
UBX_MGA_ACK_DATA0_t *packetUBXMGAACK = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
||||||
UBX_MGA_DBD_t *packetUBXMGADBD = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
UBX_MGA_DBD_t *packetUBXMGADBD = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
||||||
|
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
NMEA_GPGGA_t *storageNMEAGPGGA = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
NMEA_GPGGA_t *storageNMEAGPGGA = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
||||||
NMEA_GNGGA_t *storageNMEAGNGGA = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
NMEA_GNGGA_t *storageNMEAGNGGA = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
||||||
NMEA_GPVTG_t *storageNMEAGPVTG = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
NMEA_GPVTG_t *storageNMEAGPVTG = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
||||||
@@ -1519,6 +1522,7 @@ public:
|
|||||||
NMEA_GNRMC_t *storageNMEAGNRMC = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
NMEA_GNRMC_t *storageNMEAGNRMC = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
||||||
NMEA_GPZDA_t *storageNMEAGPZDA = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
NMEA_GPZDA_t *storageNMEAGPZDA = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
||||||
NMEA_GNZDA_t *storageNMEAGNZDA = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
NMEA_GNZDA_t *storageNMEAGNZDA = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
|
||||||
|
#endif
|
||||||
|
|
||||||
uint16_t rtcmFrameCounter = 0; // Tracks the type of incoming byte inside RTCM frame
|
uint16_t rtcmFrameCounter = 0; // Tracks the type of incoming byte inside RTCM frame
|
||||||
|
|
||||||
@@ -1602,6 +1606,7 @@ private:
|
|||||||
bool initPacketUBXMGAACK(); // Allocate RAM for packetUBXMGAACK and initialize it
|
bool initPacketUBXMGAACK(); // Allocate RAM for packetUBXMGAACK and initialize it
|
||||||
bool initPacketUBXMGADBD(); // Allocate RAM for packetUBXMGADBD and initialize it
|
bool initPacketUBXMGADBD(); // Allocate RAM for packetUBXMGADBD and initialize it
|
||||||
|
|
||||||
|
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
bool initStorageNMEAGPGGA(); // Allocate RAM for incoming NMEA GPGGA messages and initialize it
|
bool initStorageNMEAGPGGA(); // Allocate RAM for incoming NMEA GPGGA messages and initialize it
|
||||||
bool initStorageNMEAGNGGA(); // Allocate RAM for incoming NMEA GNGGA messages and initialize it
|
bool initStorageNMEAGNGGA(); // Allocate RAM for incoming NMEA GNGGA messages and initialize it
|
||||||
bool initStorageNMEAGPVTG(); // Allocate RAM for incoming NMEA GPVTG messages and initialize it
|
bool initStorageNMEAGPVTG(); // Allocate RAM for incoming NMEA GPVTG messages and initialize it
|
||||||
@@ -1610,6 +1615,7 @@ private:
|
|||||||
bool initStorageNMEAGNRMC(); // Allocate RAM for incoming NMEA GNRMC messages and initialize it
|
bool initStorageNMEAGNRMC(); // Allocate RAM for incoming NMEA GNRMC messages and initialize it
|
||||||
bool initStorageNMEAGPZDA(); // Allocate RAM for incoming NMEA GPZDA messages and initialize it
|
bool initStorageNMEAGPZDA(); // Allocate RAM for incoming NMEA GPZDA messages and initialize it
|
||||||
bool initStorageNMEAGNZDA(); // Allocate RAM for incoming NMEA GNZDA messages and initialize it
|
bool initStorageNMEAGNZDA(); // Allocate RAM for incoming NMEA GNZDA messages and initialize it
|
||||||
|
#endif
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
TwoWire *_i2cPort; // The generic connection to user's chosen I2C hardware
|
TwoWire *_i2cPort; // The generic connection to user's chosen I2C hardware
|
||||||
|
|||||||
Reference in New Issue
Block a user