mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
fix(power): power off GPS before SYSTEMOFF to prevent battery drain on shutdown
NRF52 GPIO pins retain their last state in SYSTEMOFF. If GPS was active, PIN_GPS_EN stays HIGH and the module keeps drawing ~20mA. gps_enabled is already persisted to flash so applyGpsPrefs() restores the correct state on next boot. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1519,6 +1519,13 @@ void UITask::shutdown(bool restart){
|
|||||||
} else {
|
} else {
|
||||||
_display->turnOff();
|
_display->turnOff();
|
||||||
radio_driver.powerOff();
|
radio_driver.powerOff();
|
||||||
|
#ifdef PIN_GPS_EN
|
||||||
|
// Power off GPS before SYSTEMOFF — GPIO pins retain state in NRF52 SYSTEMOFF,
|
||||||
|
// so without this the GPS stays powered and drains the battery.
|
||||||
|
// gps_enabled is already persisted to flash; applyGpsPrefs() restores it on next boot.
|
||||||
|
pinMode(PIN_GPS_EN, OUTPUT);
|
||||||
|
digitalWrite(PIN_GPS_EN, LOW);
|
||||||
|
#endif
|
||||||
_board->powerOff();
|
_board->powerOff();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user