fix(esp32): remove case-colliding buffered radio HAL header

This commit is contained in:
mikecarper committed 2026-09-22 00:35:03 -07:00
1 parent bea968b4fa
commit 0b674e04e1
5 files changed
+19 -26

No files matched your search

+3 -2
View File
@@ -7,10 +7,11 @@
// Opted-in ESP32 boards only. Keep RadioLib's transaction/CS, BUSY polling and
// status parsing unchanged; send each full-duplex buffer in one SPI operation.
// SX1262 boards retain their configured default; LR1110 boards pass 16 MHz.
class ESP32BufferedRadioHal : public ArduinoHal {
public:
explicit ESP32BufferedRadioHal(SPIClass& bus)
: ArduinoHal(bus, SPISettings(MC_SX1262_SPI_HZ, MSBFIRST, SPI_MODE0)) {}
explicit ESP32BufferedRadioHal(SPIClass& bus, uint32_t hz = MC_SX1262_SPI_HZ)
: ArduinoHal(bus, SPISettings(hz, MSBFIRST, SPI_MODE0)) {}
void spiTransfer(uint8_t* out, size_t len, uint8_t* in) override {
if (len) spi->transferBytes(out, in, len);
}
@@ -1,16 +0,0 @@
#pragma once
#include <hal/Arduino/ArduinoHal.h>
// RadioLib's Arduino HAL transfers one byte at a time. ESP32 SPIClass can
// transfer each LR1110 command in one transaction while retaining RadioLib's
// existing CS, BUSY, status and transaction handling. LR1110 permits 16 MHz.
class Esp32BufferedRadioHal : public ArduinoHal {
public:
explicit Esp32BufferedRadioHal(SPIClass& bus, uint32_t hz = 16000000)
: ArduinoHal(bus, SPISettings(hz, MSBFIRST, SPI_MODE0)) {}
void spiTransfer(uint8_t* out, size_t len, uint8_t* in) override {
if (len) spi->transferBytes(out, in, len);
}
};
+12 -3
View File
@@ -19,8 +19,8 @@ class LR1110ProfileSwitchTests(unittest.TestCase):
"wio_wm1110": "Nrf52BufferedRadioHal",
"thinknode_m3": "Nrf52BufferedRadioHal",
"minewsemi_me25ls01": "Nrf52BufferedRadioHal",
"thinknode_m7": "Esp32BufferedRadioHal",
"thinknode_m9": "Esp32BufferedRadioHal",
"thinknode_m7": "ESP32BufferedRadioHal",
"thinknode_m9": "ESP32BufferedRadioHal",
}
for target, hal in targets.items():
with self.subTest(target=target):
@@ -32,12 +32,21 @@ class LR1110ProfileSwitchTests(unittest.TestCase):
self.assertIn(f"{hal} radioHal(", target_source)
self.assertIn("new Module(&radioHal,", target_source)
esp32_hal = (ROOT / "src/helpers/radiolib/Esp32BufferedRadioHal.h").read_text()
esp32_hal = (ROOT / "src/helpers/radiolib/ESP32BufferedRadioHal.h").read_text()
nrf52_hal = (ROOT / "src/helpers/radiolib/Nrf52BufferedRadioHal.h").read_text()
self.assertIn("SPISettings(hz, MSBFIRST, SPI_MODE0)", esp32_hal)
self.assertIn("spi->transferBytes(out, in, len)", esp32_hal)
self.assertIn("SPISettings(hz, MSBFIRST, SPI_MODE0)", nrf52_hal)
self.assertIn("spi->transfer(out, in, len)", nrf52_hal)
for target in ("thinknode_m7", "thinknode_m9"):
source = (ROOT / "variants" / target / "target.cpp").read_text()
self.assertIn("ESP32BufferedRadioHal radioHal(", source)
self.assertIn(", 16000000);", source)
def test_esp32_buffered_hal_has_one_case_insensitive_header_name(self):
names = [p.name for p in (ROOT / "src/helpers/radiolib").iterdir()
if p.name.casefold() == "esp32bufferedradiohal.h"]
self.assertEqual(names, ["ESP32BufferedRadioHal.h"])
def test_checked_irq_snapshot_restores_spi_width_and_propagates_error(self):
source = (ROOT / "src/helpers/radiolib/CustomLR1110.h").read_text()
+2 -3
View File
@@ -1,12 +1,12 @@
#include <Arduino.h>
#include "target.h"
#include <helpers/sensors/MicroNMEALocationProvider.h>
#include <helpers/radiolib/Esp32BufferedRadioHal.h>
#include <helpers/radiolib/ESP32BufferedRadioHal.h>
ThinkNodeM7Board board;
static SPIClass spi;
Esp32BufferedRadioHal radioHal(spi);
ESP32BufferedRadioHal radioHal(spi, 16000000);
RADIO_CLASS radio = new Module(&radioHal, P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY);
WRAPPER_CLASS radio_driver(radio, board);
@@ -84,4 +84,3 @@ mesh::LocalIdentity radio_new_identity() {
RadioNoiseListener rng(radio);
return mesh::LocalIdentity(&rng); // create new random identity
}
+2 -2
View File
@@ -1,10 +1,10 @@
#include <Arduino.h>
#include "target.h"
#include <helpers/radiolib/Esp32BufferedRadioHal.h>
#include <helpers/radiolib/ESP32BufferedRadioHal.h>
ThinkNodeM9Board board;
Esp32BufferedRadioHal radioHal(SPI);
ESP32BufferedRadioHal radioHal(SPI, 16000000);
RADIO_CLASS radio = new Module(&radioHal, P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY);
WRAPPER_CLASS radio_driver(radio, board);