From 7255b05ab92d08109c47dd3e280f7cbf315c509b Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 5 Nov 2026 11:30:01 -0600 Subject: [PATCH] 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. --- src/mesh/RadioLibInterface.cpp | 4 ++-- src/mesh/RadioLibInterface.h | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index f6ae93b406..307d16fead 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -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 diff --git a/src/mesh/RadioLibInterface.h b/src/mesh/RadioLibInterface.h index 1073bfa4be..e198a354ea 100644 --- a/src/mesh/RadioLibInterface.h +++ b/src/mesh/RadioLibInterface.h @@ -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