Merge pull request #136 from sparkfun/release_candidate

v2.2.9 - add a destructor to resolve issue #135
This commit is contained in:
Paul
2022-04-14 11:34:16 +01:00
committed by GitHub
3 changed files with 29 additions and 1 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name=SparkFun u-blox GNSS Arduino Library
version=2.2.8
version=2.2.9
author=SparkFun Electronics <techsupport@sparkfun.com>
maintainer=SparkFun Electronics <sparkfun.com>
sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules<br/><br/>
@@ -63,6 +63,31 @@ SFE_UBLOX_GNSS::SFE_UBLOX_GNSS(void)
#endif
}
SFE_UBLOX_GNSS::~SFE_UBLOX_GNSS(void)
{
// Destructor
end(); // Delete all allocated memory - excluding payloadCfg, payloadAuto and spiBuffer
if (payloadCfg != NULL)
{
delete[] payloadCfg; // Created with new[]
payloadCfg = NULL; // Redundant?
}
if (payloadAuto != NULL)
{
delete[] payloadAuto; // Created with new[]
payloadAuto = NULL; // Redundant?
}
if (spiBuffer != NULL)
{
delete[] spiBuffer; // Created with new[]
spiBuffer = NULL; // Redundant?
}
}
// Stop all automatic message processing. Free all used RAM
void SFE_UBLOX_GNSS::end(void)
{
@@ -70,6 +95,8 @@ void SFE_UBLOX_GNSS::end(void)
// Note: payloadAuto is not deleted
// Note: spiBuffer is not deleted
if (ubxFileBuffer != NULL) // Check if RAM has been allocated for the file buffer
{
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
@@ -643,6 +643,7 @@ class SFE_UBLOX_GNSS
{
public:
SFE_UBLOX_GNSS(void);
~SFE_UBLOX_GNSS(void);
// A default of 250ms for maxWait seems fine for I2C but is not enough for SerialUSB.
// If you know you are only going to be using I2C / Qwiic communication, you can