Skip to content

Commit 65fb2ca

Browse files
committed
Fix GPS +8mA power leak when disabled (nRF52)
On the T114, GPS_RESET (pin 38) is the same pin as PIN_3V3_EN. MicroNMEALocationProvider::begin() sets pin 38 HIGH (powering the 3V3 rail) but stop() never set it back LOW, leaving the GPS module powered even when disabled. Assert reset pin in stop() to mirror begin(), and guard _location->loop() behind gps_active check. Fixes #1628
1 parent b67decf commit 65fb2ca

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/helpers/sensors/EnvironmentSensorManager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,9 @@ void EnvironmentSensorManager::loop() {
707707
static long next_gps_update = 0;
708708

709709
#if ENV_INCLUDE_GPS
710-
_location->loop();
710+
if (gps_active) {
711+
_location->loop();
712+
}
711713
if (millis() > next_gps_update) {
712714

713715
if(gps_active){

src/helpers/sensors/MicroNMEALocationProvider.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ public :
7979
if (_pin_en != -1) {
8080
digitalWrite(_pin_en, !PIN_GPS_EN_ACTIVE);
8181
}
82-
if (_peripher_power) _peripher_power->release();
82+
if (_pin_reset != -1) {
83+
digitalWrite(_pin_reset, GPS_RESET_FORCE);
84+
}
85+
if (_peripher_power) _peripher_power->release();
8386
}
8487

8588
bool isEnabled() override {

0 commit comments

Comments
 (0)