From 99603e8906368173c694ee7adeeab8bf3d9846fe Mon Sep 17 00:00:00 2001 From: sh123 Date: Wed, 20 Oct 2021 16:30:52 +0300 Subject: [PATCH] Configuraion improvements --- config.h | 9 +++++++-- esp32_loraprs.ino | 15 +++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/config.h b/config.h index b294de0..6348bcb 100644 --- a/config.h +++ b/config.h @@ -19,8 +19,13 @@ #define CFG_LORA_PIN_SS SS #define CFG_LORA_PIN_RST LORA_RST #define CFG_LORA_PIN_DIO0 LORA_IRQ -#define CFG_LORA_PIN_DIO1 LORA_IRQ -#define CFG_LORA_USE_ISR false // set to true for incoming packet ISR usage (stream mode, e.g. speech) +#ifdef USE_RADIOLIB +#define CFG_LORA_PIN_DIO1 RADIOLIB_NC // set to your DIO1 pin number if connected +#define CFG_LORA_USE_ISR true +#else +#define CFG_LORA_PIN_DIO1 LORA_IRQ // not used in arduino-LoRa +#define CFG_LORA_USE_ISR false // set to true for ISR usage +#endif #define CFG_LORA_FREQ 433.775E6 #define CFG_LORA_BW 125e3 diff --git a/esp32_loraprs.ino b/esp32_loraprs.ino index 7e8faef..a5b7707 100644 --- a/esp32_loraprs.ino +++ b/esp32_loraprs.ino @@ -1,11 +1,6 @@ #include #include "WiFi.h" -// when defined RadioLib will be used, otherwise arduino-LoRa -//#define USE_RADIOLIB - -#include "loraprs_service.h" - #if __has_include("/tmp/esp32_loraprs_config.h") #pragma message("Using external config") #include "/tmp/esp32_loraprs_config.h" @@ -20,6 +15,14 @@ #pragma message("Configured for server mode") #endif +// When USE_RADIOLIB is defined then RadioLib will be used, otherwise arduino-LoRa will be used +// When using RadioLib, default module is SX1278, if you are using +// different module then update loraprs_service.h and loraprs_service.cpp +// search for SX1278 and replace with your module name + +//#define USE_RADIOLIB +#include "loraprs_service.h" + void initializeConfig(LoraPrs::Config &cfg) { // client/server mode switch @@ -38,7 +41,7 @@ void initializeConfig(LoraPrs::Config &cfg) { cfg.LoraPinSs = CFG_LORA_PIN_SS; cfg.LoraPinRst = CFG_LORA_PIN_RST; cfg.LoraPinDio0 = CFG_LORA_PIN_DIO0; - cfg.LoraPinDio1 = CFG_LORA_PIN_DIO1; + cfg.LoraPinDio1 = CFG_LORA_PIN_DIO1; // valid for radiolib only cfg.LoraUseIsr = CFG_LORA_USE_ISR; // set to true for incoming packet ISR usage (stream mode, e.g. speech) // aprs configuration