Skip to content

v2.2.9 - add a destructor to resolve issue #135 #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -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/>
Expand Down
27 changes: 27 additions & 0 deletions src/SparkFun_u-blox_GNSS_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,40 @@ 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)
{
// Note: payloadCfg is not deleted

// 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
Expand Down
1 change: 1 addition & 0 deletions src/SparkFun_u-blox_GNSS_Arduino_Library.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down