Radio: collapse the buffered-SPI guard to one macro

RADIO_SPI_BULK_ACTIVE only ever restated RADIO_SPI_BULK plus the
architecture check, so the two tracked each other and the boot log needed
a three-term condition to say anything. Default RADIO_SPI_BULK to 1 on
Portduino instead, and the one macro guards everything.

Setting it on an architecture with no buffered call used to be silently
ignored; it is now an #error that names the reason.

Builds verified: tracker-t1000-e off and on, tbeam-s3-core on, rak4631
on, native, and the #error confirmed firing on senselora_rp2040.
This commit is contained in:
Jonathan Bennett committed 2026-11-05 11:30:01 -06:00
1 parent 078b3d4d99
commit 7255b05ab9
2 files changed
+12 -9

No files matched your search

+2 -2
View File
@@ -32,7 +32,7 @@ void LockingArduinoHal::spiEndTransaction()
spiLock->unlock();
}
#if RADIO_SPI_BULK_ACTIVE
#if RADIO_SPI_BULK
void LockingArduinoHal::spiTransfer(uint8_t *out, size_t len, uint8_t *in)
{
#if defined(ARDUINO_ARCH_ESP32)
@@ -49,7 +49,7 @@ RadioLibInterface::RadioLibInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE c
{
instance = this;
#if RADIO_SPI_BULK && RADIO_SPI_BULK_ACTIVE && !ARCH_PORTDUINO
#if RADIO_SPI_BULK && !ARCH_PORTDUINO
LOG_INFO("RADIO_SPI_BULK: one SPI transfer per radio command");
#endif
+10 -7
View File
@@ -36,15 +36,18 @@
#define AGC_FORCED_RESET_MS (24 * 60 * 60 * 1000UL)
#endif
// 1 = move each radio command as one buffered SPI transfer on nRF52 and ESP32, as Portduino already does, instead of
// RadioLib's one SPI.transfer() call per byte. Off by default pending wider soak.
// 1 = send each radio command as one buffered SPI transfer, instead of RadioLib's one
// SPI.transfer() call per byte. Portduino has always done this; nRF52 and ESP32 can opt in, and no
// other architecture has a buffered call to use. Off by default there pending a wider soak.
#ifndef RADIO_SPI_BULK
#if ARCH_PORTDUINO
#define RADIO_SPI_BULK 1
#else
#define RADIO_SPI_BULK 0
#endif
#if ARCH_PORTDUINO || (RADIO_SPI_BULK && (defined(ARDUINO_NRF52_ADAFRUIT) || defined(ARDUINO_ARCH_ESP32)))
#define RADIO_SPI_BULK_ACTIVE 1
#else
#define RADIO_SPI_BULK_ACTIVE 0
#endif
#if RADIO_SPI_BULK && !(ARCH_PORTDUINO || defined(ARDUINO_NRF52_ADAFRUIT) || defined(ARDUINO_ARCH_ESP32))
#error "RADIO_SPI_BULK: no buffered SPI call on this architecture"
#endif
/**
@@ -57,7 +60,7 @@ class LockingArduinoHal : public ArduinoHal
void spiBeginTransaction() override;
void spiEndTransaction() override;
#if RADIO_SPI_BULK_ACTIVE
#if RADIO_SPI_BULK
void spiTransfer(uint8_t *out, size_t len, uint8_t *in) override;
#endif