From f9e595687eab1e74e85a0f7f3252dfe3e12dc0b3 Mon Sep 17 00:00:00 2001 From: Rastislav Vysoky Date: Sun, 13 Jul 2025 15:21:02 +0200 Subject: [PATCH] Heltec Wireless Paper fix: radio init failed: -2 --- variants/heltec_wireless_paper/target.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/variants/heltec_wireless_paper/target.cpp b/variants/heltec_wireless_paper/target.cpp index 65eaab042..d434b2412 100644 --- a/variants/heltec_wireless_paper/target.cpp +++ b/variants/heltec_wireless_paper/target.cpp @@ -1,11 +1,14 @@ #include "target.h" - #include HeltecV3Board board; -static SPIClass spi; -RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); +#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); +#else + RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); +#endif WRAPPER_CLASS radio_driver(radio, board); @@ -21,7 +24,11 @@ DISPLAY_CLASS display; bool radio_init() { fallback_clock.begin(); rtc_clock.begin(Wire); +#if defined(P_LORA_SCLK) return radio.std_init(&spi); +#else + return radio.std_init(); +#endif } uint32_t radio_get_rng_seed() { @@ -42,4 +49,4 @@ void radio_set_tx_power(uint8_t dbm) { mesh::LocalIdentity radio_new_identity() { RadioNoiseListener rng(radio); return mesh::LocalIdentity(&rng); // create new random identity -} \ No newline at end of file +}