diff --git a/src/RF95Configuration.h b/src/RF95Configuration.h index f304aadd..66b2dcf8 100644 --- a/src/RF95Configuration.h +++ b/src/RF95Configuration.h @@ -2,6 +2,6 @@ #ifdef USE_RF95 #define RF95_RESET LORA_RESET #define RF95_IRQ LORA_DIO0 // on SX1262 version this is a no connect DIO0 -#define RF95_DIO1 LORA_DIO1 // Note: not really used for RF95 +#define RF95_DIO1 LORA_DIO1 // Note: not really used for RF95, but used for pure SX127x #define RF95_DIO2 LORA_DIO2 // Note: not really used for RF95 #endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 24b1767d..e2e39ebd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -409,7 +409,7 @@ void setup() #if defined(RF95_IRQ) if (!rIf) { - rIf = new RF95Interface(RF95_NSS, RF95_IRQ, RF95_RESET, SPI); + rIf = new RF95Interface(RF95_NSS, RF95_IRQ, RF95_RESET, RF95_DIO1, SPI); if (!rIf->init()) { LOG_WARN("Failed to find RF95 radio\n"); delete rIf; diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index 2e378aac..49872763 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -11,8 +11,9 @@ #define POWER_DEFAULT 17 // How much power to use if the user hasn't set a power level -RF95Interface::RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass &spi) - : RadioLibInterface(cs, irq, rst, RADIOLIB_NC, spi) +RF95Interface::RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, + SPIClass &spi) + : RadioLibInterface(cs, irq, rst, busy, spi) { // FIXME - we assume devices never get destroyed } diff --git a/src/mesh/RF95Interface.h b/src/mesh/RF95Interface.h index 9851020d..96c3f247 100644 --- a/src/mesh/RF95Interface.h +++ b/src/mesh/RF95Interface.h @@ -12,7 +12,7 @@ class RF95Interface : public RadioLibInterface RadioLibRF95 *lora = NULL; // Either a RFM95 or RFM96 depending on what was stuffed on this board public: - RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass &spi); + RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi); // TODO: Verify that this irq flag works with RFM95 / SX1276 radios the way it used to bool isIRQPending() override { return lora->getIRQFlags() & RADIOLIB_SX127X_MASK_IRQ_FLAG_VALID_HEADER; } diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index ef69f722..c624bc16 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -218,8 +218,9 @@ void RadioLibInterface::onNotify(uint32_t notification) setTransmitDelay(); // currently Rx/Tx-ing: reset random delay } else { if (isChannelActive()) { // check if there is currently a LoRa packet on the channel - // LOG_DEBUG("Channel is active: set random delay\n"); - setTransmitDelay(); // reset random delay + // LOG_DEBUG("Channel is active, try receiving first.\n"); + startReceive(); // try receiving this packet, afterwards we'll be trying to transmit again + setTransmitDelay(); } else { // Send any outgoing packets we have ready meshtastic_MeshPacket *txp = txQueue.dequeue(); @@ -388,8 +389,6 @@ void RadioLibInterface::startSend(meshtastic_MeshPacket *txp) LOG_WARN("startSend is dropping tx packet because we are disabled\n"); packetPool.release(txp); } else { - setStandby(); // Cancel any already in process receives - configHardwareForSend(); // must be after setStandby size_t numbytes = beginSending(txp); diff --git a/variants/heltec_v1/variant.h b/variants/heltec_v1/variant.h index 50a78662..948f6ff1 100644 --- a/variants/heltec_v1/variant.h +++ b/variants/heltec_v1/variant.h @@ -20,8 +20,8 @@ #ifndef USE_JTAG #define LORA_RESET 14 #endif -#define LORA_DIO1 35 // Not really used -#define LORA_DIO2 34 // Not really used +#define LORA_DIO1 RADIOLIB_NC +#define LORA_DIO2 32 // Not really used // ratio of voltage divider = 3.20 (R1=100k, R2=220k) #define ADC_MULTIPLIER 3.2 diff --git a/variants/heltec_v2.1/variant.h b/variants/heltec_v2.1/variant.h index 884ad83d..39a0e677 100644 --- a/variants/heltec_v2.1/variant.h +++ b/variants/heltec_v2.1/variant.h @@ -24,7 +24,7 @@ #ifndef USE_JTAG #define LORA_RESET 14 #endif -#define LORA_DIO1 35 // Not really used +#define LORA_DIO1 35 // https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436 #define LORA_DIO2 34 // Not really used #define ADC_MULTIPLIER 3.8 diff --git a/variants/heltec_v2/variant.h b/variants/heltec_v2/variant.h index 893ee320..59e0c76e 100644 --- a/variants/heltec_v2/variant.h +++ b/variants/heltec_v2/variant.h @@ -21,7 +21,7 @@ #ifndef USE_JTAG #define LORA_RESET 14 #endif -#define LORA_DIO1 35 // Not really used +#define LORA_DIO1 35 // https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436 #define LORA_DIO2 34 // Not really used // ratio of voltage divider = 3.20 (R12=100k, R10=220k) diff --git a/variants/tbeam_v07/variant.h b/variants/tbeam_v07/variant.h index ac7776c1..2c800868 100644 --- a/variants/tbeam_v07/variant.h +++ b/variants/tbeam_v07/variant.h @@ -10,7 +10,7 @@ #define USE_RF95 #define LORA_DIO0 26 // a No connect on the SX1262 module #define LORA_RESET 23 -#define LORA_DIO1 33 // Not really used +#define LORA_DIO1 33 #define LORA_DIO2 32 // Not really used // This board has different GPS pins than all other boards diff --git a/variants/tlora_v1/variant.h b/variants/tlora_v1/variant.h index c390a343..b4365a44 100644 --- a/variants/tlora_v1/variant.h +++ b/variants/tlora_v1/variant.h @@ -15,5 +15,5 @@ #define USE_RF95 #define LORA_DIO0 26 // a No connect on the SX1262 module #define LORA_RESET 14 -#define LORA_DIO1 35 // Not really used -#define LORA_DIO2 34 // Not really used +#define LORA_DIO1 33 // Must be manually wired: https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436 +#define LORA_DIO2 32 // Not really used diff --git a/variants/tlora_v1_3/variant.h b/variants/tlora_v1_3/variant.h index f5240d14..7e8aec0c 100644 --- a/variants/tlora_v1_3/variant.h +++ b/variants/tlora_v1_3/variant.h @@ -18,5 +18,5 @@ #define USE_RF95 #define LORA_DIO0 26 // a No connect on the SX1262 module #define LORA_RESET 14 -#define LORA_DIO1 35 // Not really used -#define LORA_DIO2 34 // Not really used \ No newline at end of file +#define LORA_DIO1 33 // Prob. must be manually wired: https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436 +#define LORA_DIO2 32 // Not really used \ No newline at end of file diff --git a/variants/tlora_v2/variant.h b/variants/tlora_v2/variant.h index 0c854e37..f1850313 100644 --- a/variants/tlora_v2/variant.h +++ b/variants/tlora_v2/variant.h @@ -18,5 +18,5 @@ #define USE_RF95 #define LORA_DIO0 26 // a No connect on the SX1262 module #define LORA_RESET 14 -#define LORA_DIO1 35 // Not really used -#define LORA_DIO2 34 // Not really used +#define LORA_DIO1 33 // Must be manually wired: https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436 +#define LORA_DIO2 32 // Not really used diff --git a/variants/tlora_v2_1_16/variant.h b/variants/tlora_v2_1_16/variant.h index 74b82d8c..11c5921b 100644 --- a/variants/tlora_v2_1_16/variant.h +++ b/variants/tlora_v2_1_16/variant.h @@ -18,3 +18,5 @@ #define USE_RF95 #define LORA_DIO0 26 // a No connect on the SX1262 module #define LORA_RESET 23 +#define LORA_DIO1 33 // https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436 +#define LORA_DIO2 32 // Not really used