Harden nRF52 shutdown and radio recovery

This commit is contained in:
mikecarper committed 2026-07-31 16:01:02 -07:00
1 parent 86160e9323
commit 308589afa3
20 files changed
+107 -43

No files matched your search

+10
View File
@@ -467,6 +467,16 @@ void NRF52Board::shutdownPeripherals() {
// Power off LoRa
radio_driver.powerOff();
// RadioLib's IRQ setup can leave DIO1 as a GPIO wake source. Once the radio
// is asleep that line may float or remain asserted, immediately waking an
// nRF52 that is trying to enter SYSTEMOFF. Release the interrupt channel and
// explicitly disable pin sensing; board-specific code can then arm only its
// intended wake source (for example, the SenseCAP user button or LPCOMP).
#ifdef P_LORA_DIO_1
detachInterrupt(P_LORA_DIO_1);
pinMode(P_LORA_DIO_1, INPUT);
#endif
// Keep LoRa inactive during deepsleep
#ifdef P_LORA_NSS
digitalWrite(P_LORA_NSS, HIGH);
@@ -50,6 +50,7 @@ public:
}
uint8_t getSpreadingFactor() const override { return ((CustomSX1262 *)_radio)->spreadingFactor; }
virtual void powerOff() override {
((CustomSX1262 *)_radio)->standby();
((CustomSX1262 *)_radio)->sleep(false);
}
+1 -1
View File
@@ -120,7 +120,7 @@ public:
}
void begin() override;
virtual void powerOff() { _radio->sleep(); }
virtual void powerOff() { _radio->standby(); _radio->sleep(); }
int recvRaw(uint8_t* bytes, int sz) override;
uint32_t getEstAirtimeFor(int len_bytes) override;
bool startSendRaw(const uint8_t* bytes, int len) override;