From 3a3f69fb5d5038ddfa8e6dfd0fce401c231cf9fc Mon Sep 17 00:00:00 2001 From: Martin Boissonneault <19229816+Ve2mrx@users.noreply.github.com> Date: Sat, 14 Nov 2026 17:42:51 -0500 Subject: [PATCH 1/3] rak4631: forward the first-fix limit and gps diag to the serial GPS RakLocationProvider wraps a MicroNMEALocationProvider but did not override setFirstFixTimeout(), getFirstFixTimeout() or formatDiagnostics(), so on RAK4631 boards with a serial GPS: - `gps firstfix` always answered "0 (no limit)" (the LocationProvider default), while the limit in force was the build default (1 h); - `gps firstfix ` saved the value but never applied it, at once or at boot; - `gps diag` gave the short base form, without the UART/NMEA counters or fm:. Forward all three to the NMEA provider. The RAK12500 (I2C) path has no first-fix limit, so it keeps reporting 0 and the short diagnostics. Co-Authored-By: Claude Opus 5.5 --- src/helpers/sensors/RakLocationProvider.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/helpers/sensors/RakLocationProvider.h b/src/helpers/sensors/RakLocationProvider.h index 2dda12a5..f395530f 100644 --- a/src/helpers/sensors/RakLocationProvider.h +++ b/src/helpers/sensors/RakLocationProvider.h @@ -211,6 +211,20 @@ public: return _gpsPeriodSeconds; } + // the first-fix limit is only implemented on the serial NMEA path + void setFirstFixTimeout(uint32_t seconds) override { + _nmea.setFirstFixTimeout(seconds); + } + + uint32_t getFirstFixTimeout() const override { + return _useI2c ? 0 : _nmea.getFirstFixTimeout(); + } + + void formatDiagnostics(char* out, size_t out_size) override { + if (_useI2c) LocationProvider::formatDiagnostics(out, out_size); + else _nmea.formatDiagnostics(out, out_size); + } + bool isGpsOn() const override { return _useI2c ? _gpsOn : _nmea.isGpsOn(); } From d1c71522b811e1e3e63acd44a86b54c1af37afeb Mon Sep 17 00:00:00 2001 From: Martin Boissonneault <19229816+Ve2mrx@users.noreply.github.com> Date: Sat, 14 Nov 2026 18:23:54 -0500 Subject: [PATCH 2/3] gps: don't let the settle time close a periodic window before the time sync In periodic mode a window closed after GPS_FIX_SETTLE_MS (10 s) from the first fix even if the clock sync was still pending. The sync needs about 4 s of continuous valid fixes (time_valid > 2, reset on any pass without a fix), so after a hot start, when the receiver reports a fix within seconds but not yet steadily, the window could close unsynced. On a board without an RTC the clock then stays at its default until the next window, a whole period later. Close the window only once the sync has been tried (done, not needed, or refused by GPS_GUARD); the settle time and the satellite count apply after that. The acquisition timeout still bounds the window. Co-Authored-By: Claude Opus 5.5 --- src/helpers/sensors/MicroNMEALocationProvider.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/helpers/sensors/MicroNMEALocationProvider.h b/src/helpers/sensors/MicroNMEALocationProvider.h index 34480b45..85262ba4 100644 --- a/src/helpers/sensors/MicroNMEALocationProvider.h +++ b/src/helpers/sensors/MicroNMEALocationProvider.h @@ -169,6 +169,12 @@ class MicroNMEALocationProvider : public LocationProvider { if (isValid()) time_valid++; } + // the time sync has had its chance: done, not needed, or refused by GPS_GUARD. + // updateTime() tries it on the tick where time_valid goes from 3 to 4. + bool timeSyncSettled() const { + return _clock == nullptr || !_time_sync_needed || time_valid > 3; + } + bool timeSyncAllowed() { #ifdef GPS_GUARD return _guard.acceptTime(getTimestamp(), _clock->getCurrentTime()); @@ -403,10 +409,13 @@ public: const uint8_t mode = currentFixMode(); if (mode == 0 || mode == 3) _goodFixInWindow = true; if (_acquiringPeriodically && _goodFixInWindow) { - // stay on until a pending time sync is done (or the settle time is over) - const bool synced = _clock == nullptr || !_time_sync_needed; - if ((nmea.getNumSatellites() >= GPS_MIN_SATS_FOR_FIX && synced) || - (uint32_t)(millis() - _firstFixInWindow) >= GPS_FIX_SETTLE_MS) { + // stay on until a pending time sync has been tried, even past the settle + // time: after a hot start the fix can come before the time is steady, and + // the window would close unsynced until the next period. The acquisition + // timeout below still bounds it. + if (timeSyncSettled() && + (nmea.getNumSatellites() >= GPS_MIN_SATS_FOR_FIX || + (uint32_t)(millis() - _firstFixInWindow) >= GPS_FIX_SETTLE_MS)) { finishPeriodicAcquisition(); } } From fe520673ae992888486af84d01a6f90c69518391 Mon Sep 17 00:00:00 2001 From: Cyclic3 Date: Sat, 14 Nov 2026 12:01:14 +0000 Subject: [PATCH 3/3] Fix USB serial issue on Xiao ESP32-S3 Wio (#1416) (#3726) * Initial attempt at fixing serial issue on Xiao ESP32-S3 Wio (#1416) * restrict Xiao ESP32-S3 WIO fix to just that board --- variants/xiao_s3_wio/XiaoS3WIOBoard.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/variants/xiao_s3_wio/XiaoS3WIOBoard.h b/variants/xiao_s3_wio/XiaoS3WIOBoard.h index 7ae06a35..4a635334 100644 --- a/variants/xiao_s3_wio/XiaoS3WIOBoard.h +++ b/variants/xiao_s3_wio/XiaoS3WIOBoard.h @@ -7,6 +7,13 @@ class XiaoS3WIOBoard : public ESP32Board { public: XiaoS3WIOBoard() { } + void begin() { + while (!Serial.availableForWrite()) + delay(10); + + ESP32Board::begin(); + } + const char* getManufacturerName() const override { return "Xiao S3 WIO"; }