Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/helpers/NRF52Board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ void NRF52Board::enterSystemOff(uint8_t reason) {
NRF_POWER->GPREGRET2 = reason;
}

// Turn off the BLE connection LED before deep sleep. Bluefruit's autoConnLed
// (on by default) drives LED_CONN; nRF52 SYSTEMOFF only halts the core and
// leaves GPIO outputs latched in their last state, so the LED would otherwise
// stay lit through hibernation. Stop BLE re-driving the pin, then pull it low.
if (sd_enabled) {
Bluefruit.autoConnLed(false); // stop BLE re-driving the LED
Bluefruit.Advertising.stop(); // stop advertising + its blink timer
}
#if defined(LED_CONN) && (LED_CONN >= 0)
ledOff(LED_CONN); // polarity-aware (respects LED_STATE_ON)
#endif

// Flush serial buffers
Serial.flush();
delay(100);
Expand Down