NmeaGpsDriver: close the UART while gps duty keeps the GPS off (nRF52)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-14 10:42:33 +01:00
1 parent 562b93364d
commit 5970edc99c
1 file changed
+9
+9
View File
@@ -198,6 +198,14 @@ class NmeaGpsDriver : public GpsDriver {
if (_resetPin != -1) digitalWrite(_resetPin, _resetActive);
if (_peripheralPower != nullptr) _peripheralPower->release();
#if defined(NRF52_PLATFORM)
// CUSTOM (TeTeHacko): close the UART that startHardware() opened. Left open,
// an nRF52 UARTE keeps its receiver and the HF clock running (~900 uA per the
// core's own Uart::end()) for all the hours `gps duty` keeps the GPS off, and
// its idle-high TX line feeds the unpowered module. sendNmeaSentence() is
// gated on _started: a write to a closed Uart takes a deleted semaphore.
if (_hardwareSerial != nullptr) _hardwareSerial->end();
#endif
_started = false;
}
@@ -333,6 +341,7 @@ public:
void sendNmeaSentence(const char* sentence) {
if (_hardwareSerial == nullptr || sentence == nullptr || sentence[0] != '$') return;
if (!_started) return; // CUSTOM (TeTeHacko): the UART is closed, see stopHardware()
uint8_t checksum = 0;
const char* p = sentence + 1;