fix(rak3401): sleep onboard SX1262 before boot voltage check

Move the onboard radio probe into RAK3401Board::begin() so a low-voltage
SYSTEMOFF at boot no longer leaves the RAK4631's onboard SX1262 in
standby. Add board startup tests and run them in CI.
This commit is contained in:
agessaman committed 2026-10-16 20:46:04 -07:00
1 parent 6dc7f2b047
commit 277cae93ac
9 files changed
+157 -6

No files matched your search

+3
View File
@@ -6,6 +6,9 @@ namespace rak3401 {
enum class OnboardRadioState { Absent, Asleep, BusyTimeout, SleepFailed };
// Board startup only, before the primary radio starts SPI.
OnboardRadioState sleepOnboardRadio();
// IO owns the temporary SPI pin assignment; every outcome must release it.
template <typename IO>
OnboardRadioState sleepOnboardRadio(IO& io, const char* expectedVersion) {
+3
View File
@@ -2,6 +2,7 @@
#include <Wire.h>
#include "RAK3401Board.h"
#include "OnboardRadioSleep.h"
#ifdef NRF52_POWER_MANAGEMENT
// Static configuration for power management
@@ -30,6 +31,8 @@ void RAK3401Board::initiateShutdown(uint8_t reason) {
void RAK3401Board::begin() {
NRF52BoardDCDC::begin();
// Voltage protection can enter SYSTEMOFF before radio_init() is reached.
rak3401::sleepOnboardRadio();
pinMode(PIN_VBAT_READ, INPUT);
#ifdef PIN_USER_BTN
pinMode(PIN_USER_BTN, INPUT_PULLUP);
+6 -3
View File
@@ -107,9 +107,7 @@ public:
};
}
bool radio_init() {
rtc_clock.begin(Wire);
// Called once from setup, before SPI is started for the RAK13302.
rak3401::OnboardRadioState rak3401::sleepOnboardRadio() {
OnboardRadioIO onboard;
const uint32_t started = millis();
// The SX1262 version register shares the "SX1261" prefix used by RadioLib.
@@ -119,6 +117,11 @@ bool radio_init() {
state == rak3401::OnboardRadioState::BusyTimeout ? "busy-timeout" : "sleep-failed";
MESH_DEBUG_PRINTLN("onboard SX1262: %s elapsed=%lu ms", outcome,
(unsigned long)(millis() - started));
return state;
}
bool radio_init() {
rtc_clock.begin(Wire);
return radio.std_init(&SPI);
}