Add a fix to allow the auto-NMEA examples to compile on ATmega2560/1280
This commit is contained in:
@@ -80,14 +80,18 @@ There is a [new example](./examples/Dead_Reckoning/Example8_getNAVPVAT) showing
|
|||||||
|
|
||||||
## Memory Usage
|
## Memory Usage
|
||||||
|
|
||||||
The u-blox GNSS library has grown considerably over the years and v2.0.8 came very close to completely filling the program memory on platforms like the ATmega328 (Arduino Uno).
|
The u-blox GNSS library has grown considerably over the years and now exceeds the available program memory on platforms like the ATmega328 (Arduino Uno).
|
||||||
If you want to reduce the amount of memory used by the library, you can edit the header file (_SparkFun_u-blox_GNSS_Arduino_Library.h_) and uncomment line 60:
|
If you want to reduce the amount of memory used by the library, you can edit the header file (_SparkFun_u-blox_GNSS_Arduino_Library.h_) and uncomment lines 60 and 63:
|
||||||
|
|
||||||
```
|
```
|
||||||
#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 to save memory
|
||||||
```
|
```
|
||||||
|
|
||||||
Doing this will save approximately 15% of the program memory used by the library. From v2.0.18 of the library, the debug messages are automatically deleted on ARDUINO_AVR_UNO platforms. For other platforms, you will need to uncomment that line manually.
|
```
|
||||||
|
#define SFE_UBLOX_DISABLE_AUTO_NMEA // Uncommenting this line will disable auto-NMEA support to save memory
|
||||||
|
```
|
||||||
|
|
||||||
|
**Please note:** the debug messages are automatically deleted and auto-NMEA support is automatically disabled on ARDUINO_AVR_UNO platforms. For other platforms, you will need to uncomment those lines manually.
|
||||||
|
|
||||||
On Windows, you will normally find _SparkFun_u-blox_GNSS_Arduino_Library.h_ in:
|
On Windows, you will normally find _SparkFun_u-blox_GNSS_Arduino_Library.h_ in:
|
||||||
- Documents\Arduino\libraries\SparkFun_u-blox_GNSS_Arduino_Library\src
|
- Documents\Arduino\libraries\SparkFun_u-blox_GNSS_Arduino_Library\src
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ In v2.0, the full list of messages which can be processed and logged automatical
|
|||||||
- UBX-NAV-HPPOSLLH (0x01 0x14): High precision geodetic position solution
|
- UBX-NAV-HPPOSLLH (0x01 0x14): High precision geodetic position solution
|
||||||
- UBX-NAV-PVAT (0x01 0x17): Navigation position velocity attitude time solution (**only with ADR or UDR products**)
|
- UBX-NAV-PVAT (0x01 0x17): Navigation position velocity attitude time solution (**only with ADR or UDR products**)
|
||||||
- UBX-NAV-CLOCK (0x01 0x22): Clock solution
|
- UBX-NAV-CLOCK (0x01 0x22): Clock solution
|
||||||
|
- UBX-NAV-SAT (0x01 0x35): Satellite information
|
||||||
- UBX-NAV-SVIN (0x01 0x3B): Survey-in data (**only with High Precision GNSS products**)
|
- UBX-NAV-SVIN (0x01 0x3B): Survey-in data (**only with High Precision GNSS products**)
|
||||||
- UBX-NAV-RELPOSNED (0x01 0x3C): Relative positioning information in NED frame (**only with High Precision GNSS products**)
|
- UBX-NAV-RELPOSNED (0x01 0x3C): Relative positioning information in NED frame (**only with High Precision GNSS products**)
|
||||||
- UBX-NAV-AOPSTATUS (0x01 0x60): AssistNow Autonomous status
|
- UBX-NAV-AOPSTATUS (0x01 0x60): AssistNow Autonomous status
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
Get the GPGGA NMEA sentence using getLatestNMEAGPGGA
|
Get the GPGGA NMEA sentence using getLatestNMEAGPGGA
|
||||||
By: Paul Clark
|
By: Paul Clark
|
||||||
SparkFun Electronics
|
SparkFun Electronics
|
||||||
Date: January 12th, 2021
|
Date: January 12th, 2022
|
||||||
License: MIT. See license file for more information but you can
|
License: MIT. See license file for more information but you can
|
||||||
basically do whatever you want with this code.
|
basically do whatever you want with this code.
|
||||||
|
|
||||||
|
** Please note: this example will not run on Arduino Uno. See https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/blob/main/README.md#memory-usage
|
||||||
|
|
||||||
This example shows how to turn on/off the NMEA sentences being output over I2C.
|
This example shows how to turn on/off the NMEA sentences being output over I2C.
|
||||||
It then demonstrates how to use the new getLatestNMEAGPGGA function to retrieve the latest GPGGA message.
|
It then demonstrates how to use the new getLatestNMEAGPGGA function to retrieve the latest GPGGA message.
|
||||||
getLatestNMEAGPGGA returns immediately - it is not blocking.
|
getLatestNMEAGPGGA returns immediately - it is not blocking.
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
Get the latest GPGGA / GNGGA NMEA sentence using callbacks
|
Get the latest GPGGA / GNGGA NMEA sentence using callbacks
|
||||||
By: Paul Clark
|
By: Paul Clark
|
||||||
SparkFun Electronics
|
SparkFun Electronics
|
||||||
Date: January 12th, 2021
|
Date: January 12th, 2022
|
||||||
License: MIT. See license file for more information but you can
|
License: MIT. See license file for more information but you can
|
||||||
basically do whatever you want with this code.
|
basically do whatever you want with this code.
|
||||||
|
|
||||||
|
** Please note: this example will not run on Arduino Uno. See https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/blob/main/README.md#memory-usage
|
||||||
|
|
||||||
This example shows how to turn on/off the NMEA sentences being output over I2C.
|
This example shows how to turn on/off the NMEA sentences being output over I2C.
|
||||||
It then demonstrates how to get the latest GPGGA or GNGGA message autonomously using callbacks.
|
It then demonstrates how to get the latest GPGGA or GNGGA message autonomously using callbacks.
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -2,10 +2,12 @@
|
|||||||
Get the NMEA sentence using getLatestNMEAGPxxx (GGA, VTG, RMC, ZDA)
|
Get the NMEA sentence using getLatestNMEAGPxxx (GGA, VTG, RMC, ZDA)
|
||||||
By: Paul Clark
|
By: Paul Clark
|
||||||
SparkFun Electronics
|
SparkFun Electronics
|
||||||
Date: March 2nd, 2021
|
Date: March 2nd, 2022
|
||||||
License: MIT. See license file for more information but you can
|
License: MIT. See license file for more information but you can
|
||||||
basically do whatever you want with this code.
|
basically do whatever you want with this code.
|
||||||
|
|
||||||
|
** Please note: this example will not run on Arduino Uno. See https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/blob/main/README.md#memory-usage
|
||||||
|
|
||||||
This example shows how to turn on/off the NMEA sentences being output over I2C.
|
This example shows how to turn on/off the NMEA sentences being output over I2C.
|
||||||
It then demonstrates how to use the new getLatestNMEAGPxxx function to retrieve the latest GPGGA message.
|
It then demonstrates how to use the new getLatestNMEAGPxxx function to retrieve the latest GPGGA message.
|
||||||
getLatestNMEAGPxxx returns immediately - it is not blocking.
|
getLatestNMEAGPxxx returns immediately - it is not blocking.
|
||||||
|
|||||||
+3
-1
@@ -2,10 +2,12 @@
|
|||||||
Get the latest GGA, VTG, RMC, ZDA NMEA sentence using callbacks
|
Get the latest GGA, VTG, RMC, ZDA NMEA sentence using callbacks
|
||||||
By: Paul Clark
|
By: Paul Clark
|
||||||
SparkFun Electronics
|
SparkFun Electronics
|
||||||
Date: March 2nd, 2021
|
Date: March 2nd, 2022
|
||||||
License: MIT. See license file for more information but you can
|
License: MIT. See license file for more information but you can
|
||||||
basically do whatever you want with this code.
|
basically do whatever you want with this code.
|
||||||
|
|
||||||
|
** Please note: this example will not run on Arduino Uno. See https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/blob/main/README.md#memory-usage
|
||||||
|
|
||||||
This example shows how to turn on/off the NMEA sentences being output over I2C.
|
This example shows how to turn on/off the NMEA sentences being output over I2C.
|
||||||
It then demonstrates how to get the latest GGA, VTG, RMC or ZDA message autonomously using callbacks.
|
It then demonstrates how to get the latest GGA, VTG, RMC or ZDA message autonomously using callbacks.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
Get the jamming state and indication
|
Get the jamming state and indication
|
||||||
By: Paul Clark
|
By: Paul Clark
|
||||||
SparkFun Electronics
|
SparkFun Electronics
|
||||||
Date: March 2nd, 2021
|
Date: March 2nd, 2022
|
||||||
License: MIT. See license file for more information but you can
|
License: MIT. See license file for more information but you can
|
||||||
basically do whatever you want with this code.
|
basically do whatever you want with this code.
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ void loop()
|
|||||||
|
|
||||||
if (myGNSS.getHWstatus(&hwStatus)) // Read the hardware status
|
if (myGNSS.getHWstatus(&hwStatus)) // Read the hardware status
|
||||||
{
|
{
|
||||||
Serial.println(F("Hardware status (UBX_MON_RF):"));
|
Serial.println(F("Hardware status (UBX_MON_HW):"));
|
||||||
|
|
||||||
Serial.print(F("Jamming state: "));
|
Serial.print(F("Jamming state: "));
|
||||||
Serial.print(hwStatus.flags.bits.jammingState);
|
Serial.print(hwStatus.flags.bits.jammingState);
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ void SFE_UBLOX_GNSS::end(void)
|
|||||||
packetUBXHNRPVT = NULL; // Redundant?
|
packetUBXHNRPVT = NULL; // Redundant?
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
#ifndef SFE_UBLOX_DISABLE_AUTO_NMEA
|
||||||
if (storageNMEAGPGGA != NULL)
|
if (storageNMEAGPGGA != NULL)
|
||||||
{
|
{
|
||||||
if (storageNMEAGPGGA->callbackCopy != NULL)
|
if (storageNMEAGPGGA->callbackCopy != NULL)
|
||||||
@@ -1863,7 +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
|
#ifndef SFE_UBLOX_DISABLE_AUTO_NMEA
|
||||||
// Check if we have automatic storage for this message
|
// Check if we have automatic storage for this message
|
||||||
if (isThisNMEAauto())
|
if (isThisNMEAauto())
|
||||||
{
|
{
|
||||||
@@ -1902,7 +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
|
#ifndef SFE_UBLOX_DISABLE_AUTO_NMEA
|
||||||
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
|
||||||
@@ -1938,7 +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
|
#ifndef SFE_UBLOX_DISABLE_AUTO_NMEA
|
||||||
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
|
||||||
@@ -2194,7 +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
|
#ifndef SFE_UBLOX_DISABLE_AUTO_NMEA
|
||||||
// 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()
|
||||||
{
|
{
|
||||||
@@ -5568,7 +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
|
#ifndef SFE_UBLOX_DISABLE_AUTO_NMEA
|
||||||
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
|
||||||
@@ -14818,7 +14818,7 @@ uint32_t SFE_UBLOX_GNSS::getProcessNMEAMask()
|
|||||||
return (_processNMEA.all);
|
return (_processNMEA.all);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
|
#ifndef SFE_UBLOX_DISABLE_AUTO_NMEA
|
||||||
// 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
|
||||||
|
|||||||
@@ -57,12 +57,19 @@
|
|||||||
#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 and disable auto-NMEA support to save memory
|
//#define SFE_UBLOX_REDUCED_PROG_MEM // Uncommenting this line will delete the minor debug messages to save memory
|
||||||
|
|
||||||
// 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
|
// Uncomment the next line (or add SFE_UBLOX_DISABLE_AUTO_NMEA as a compiler directive) to reduce the amount of program memory used by the library
|
||||||
#if !defined(SFE_UBLOX_REDUCED_PROG_MEM) && defined(ARDUINO_ARCH_AVR)
|
//#define SFE_UBLOX_DISABLE_AUTO_NMEA // Uncommenting this line will disable auto-NMEA support to save memory
|
||||||
|
|
||||||
|
// The code exceeds the program memory on the ATmega328P (Arduino Uno), so let's delete the minor debug messages and disable auto-NMEA support anyway
|
||||||
|
// However, the ATmega2560 and ATmega1280 _do_ have enough memory, so let's exclude those
|
||||||
|
#if !defined(SFE_UBLOX_REDUCED_PROG_MEM) && defined(ARDUINO_ARCH_AVR) && !defined(ARDUINO_AVR_MEGA2560) && !defined(ARDUINO_AVR_MEGA) && !defined(ARDUINO_AVR_ADK)
|
||||||
#define SFE_UBLOX_REDUCED_PROG_MEM
|
#define SFE_UBLOX_REDUCED_PROG_MEM
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(SFE_UBLOX_DISABLE_AUTO_NMEA) && defined(ARDUINO_ARCH_AVR) && !defined(ARDUINO_AVR_MEGA2560) && !defined(ARDUINO_AVR_MEGA) && !defined(ARDUINO_AVR_ADK)
|
||||||
|
#define SFE_UBLOX_DISABLE_AUTO_NMEA
|
||||||
|
#endif
|
||||||
|
|
||||||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
|
|
||||||
@@ -1431,7 +1438,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
|
#ifndef SFE_UBLOX_DISABLE_AUTO_NMEA
|
||||||
// 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
|
||||||
@@ -1513,7 +1520,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
|
#ifndef SFE_UBLOX_DISABLE_AUTO_NMEA
|
||||||
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
|
||||||
@@ -1606,7 +1613,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
|
#ifndef SFE_UBLOX_DISABLE_AUTO_NMEA
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user