From a37caf15071b9a2e4758335eaafc858349669698 Mon Sep 17 00:00:00 2001 From: mikecarper Date: Sun, 20 Sep 2026 08:16:00 -0700 Subject: [PATCH] feat(kiss): enable fast profile scanning on Station G3 --- docs/radio_profiles.md | 11 ++++++----- variants/station_g3_esp32/platformio.ini | 8 ++++++++ variants/station_g3_esp32/target.cpp | 14 +++++++++++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/docs/radio_profiles.md b/docs/radio_profiles.md index 8a042b194..2e60cd8fb 100644 --- a/docs/radio_profiles.md +++ b/docs/radio_profiles.md @@ -476,11 +476,12 @@ tested redundant standby/IRQ/buffer/packet setup and SPI transfer changes. Its fastest candidate measured 0.535 ms mean on XIAO but 8.203 ms on the Indicator, whose radio GPIOs go through an I2C expander. The validated production implementation now opts XIAO S3 WIO and Indicator LoRa into buffered 8 MHz SPI -and a guarded fast-RX state machine. The `heltec_v4_kiss_modem` target uses the -same guarded path only for KISS dual-profile scanning; its normal V4 roles keep -their established HAL/timing policy. That host-powered KISS target uses the -existing V4 160 MHz role override, but still needs an exact-image hardware -timing check before its nominal 600 µs target is claimed. It skips redundant +and a guarded fast-RX state machine. The `heltec_v4_kiss_modem` and +`Station_G3_ESP32_kiss_modem` targets use the same guarded path only for KISS +dual-profile scanning; their normal board roles keep their established +HAL/timing policy. V4 uses its existing 160 MHz role override and Station G3 +uses its base 240 MHz setting, but both still need an exact-image hardware +timing check before a nominal 600 µs target is claimed. It skips redundant standby, IRQ mapping, buffer-base writes and modem queries only during an owned continuous RX-to-RX retune. Preamble/packet parameters (including the IQ workaround), stale-IRQ diff --git a/variants/station_g3_esp32/platformio.ini b/variants/station_g3_esp32/platformio.ini index 189d3c2af..5c1ca9d4f 100644 --- a/variants/station_g3_esp32/platformio.ini +++ b/variants/station_g3_esp32/platformio.ini @@ -171,6 +171,14 @@ build_flags = extends = Station_G3_ESP32 build_src_filter = ${Station_G3_ESP32.build_src_filter} +<../examples/kiss_modem/> +build_flags = + ${Station_G3_ESP32.build_flags} + ; KISS profile switching is performed locally by the SX1262 scanner, not + ; through serial host round trips. Keep this fast-RX/buffered-SPI opt-in + ; isolated to the host-powered modem image. + -D MC_SX1262_FAST_PROFILE_SWITCH=1 + -D MC_SX1262_BUFFERED_RADIO_HAL=1 + -D MC_SX1262_SPI_HZ=8000000 [env:Station_G3_ESP32_repeater_observer_mqtt] extends = Station_G3_ESP32 diff --git a/variants/station_g3_esp32/target.cpp b/variants/station_g3_esp32/target.cpp index d3de074ba..c0c026379 100644 --- a/variants/station_g3_esp32/target.cpp +++ b/variants/station_g3_esp32/target.cpp @@ -1,11 +1,23 @@ #include #include "target.h" +// The normal Station G3 roles retain the established RadioLib Arduino HAL. +// The KISS modem can opt into buffered SPI for its on-board dual-profile RX +// scanner without changing the regular Station firmware. +#if defined(MC_SX1262_BUFFERED_RADIO_HAL) && MC_SX1262_BUFFERED_RADIO_HAL + #include +#endif + StationG3Board board; #if defined(P_LORA_SCLK) static SPIClass spi; - RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); + #if defined(MC_SX1262_BUFFERED_RADIO_HAL) && MC_SX1262_BUFFERED_RADIO_HAL + static ESP32BufferedRadioHal radio_hal(spi); + RADIO_CLASS radio = new Module(&radio_hal, P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); + #else + RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); + #endif #else RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); #endif