From aff9d56e8e40335a9c92836af3a24e21edc4a513 Mon Sep 17 00:00:00 2001 From: 94xhn <87560781+94xhn@users.noreply.github.com> Date: Wed, 15 Jul 2026 13:02:15 +0800 Subject: [PATCH 1/3] Fix file-buffer exact-fit guard to prevent silent data loss storePacket() and storeFileBytes() used a strict '>' when checking whether a write fits in the file buffer's available space. This let a write of exactly fileBufferSpaceAvailable() bytes succeed, which can bring fileBufferHead back around to equal fileBufferTail. Since head == tail is used elsewhere to mean 'buffer empty', the just written bytes become invisible to fileBufferSpaceUsed() and are silently lost from extractFileBufferData(). Changing both guards to '>=' reserves fileBufferSize - 1 as the buffer's usable capacity (the standard fix for ring buffers that use head == tail to mean empty), so a write can never exactly fill the buffer and recreate the ambiguity. --- src/SparkFun_u-blox_GNSS_Arduino_Library.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp index 4ed6325c..2f02cf42 100644 --- a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp +++ b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp @@ -7124,7 +7124,7 @@ bool SFE_UBLOX_GNSS::storePacket(ubxPacket *msg) // Now, check if there is enough space in the buffer for all of the data uint16_t totalLength = msg->len + 8; // Total length. Include sync chars, class, id, length and checksum bytes - if (totalLength > fileBufferSpaceAvailable()) + if (totalLength >= fileBufferSpaceAvailable()) // Use >= so a write can never exactly fill the buffer (head == tail would then wrongly mean empty) { #ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging @@ -7175,7 +7175,7 @@ bool SFE_UBLOX_GNSS::storeFileBytes(uint8_t *theBytes, uint16_t numBytes) } // Now, check if there is enough space in the buffer for all of the data - if (numBytes > fileBufferSpaceAvailable()) + if (numBytes >= fileBufferSpaceAvailable()) // Use >= so a write can never exactly fill the buffer (head == tail would then wrongly mean empty) { #ifndef SFE_UBLOX_REDUCED_PROG_MEM if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging From fdbfa5657eddb3c3d9c5c35ff7911e3b0e5688c8 Mon Sep 17 00:00:00 2001 From: PaulZC Date: Wed, 15 Jul 2026 11:53:13 +0100 Subject: [PATCH 2/3] v2.2.29 --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 1fd62589..88790b8b 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SparkFun u-blox GNSS Arduino Library -version=2.2.28 +version=2.2.29 author=SparkFun Electronics maintainer=SparkFun Electronics sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules

From 1dc8e56d106b2f8ca0cd81ac7e5c24edcd924c14 Mon Sep 17 00:00:00 2001 From: PaulZC Date: Wed, 15 Jul 2026 11:58:04 +0100 Subject: [PATCH 3/3] Switch from uno to mega to avoid failing RAM check --- .github/workflows/compile-sketch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compile-sketch.yml b/.github/workflows/compile-sketch.yml index 4b7eadd0..e2e0e540 100644 --- a/.github/workflows/compile-sketch.yml +++ b/.github/workflows/compile-sketch.yml @@ -16,7 +16,7 @@ jobs: board: # Uno # https://github.com/arduino/ArduinoCore-avr/blob/master/boards.txt - - fqbn: arduino:avr:uno + - fqbn: arduino:avr:mega platforms: | - name: arduino:avr source-url: https://downloads.arduino.cc/packages/package_index.json