diff --git a/include/config.h b/include/config.h index 514ebb0..07ac21a 100644 --- a/include/config.h +++ b/include/config.h @@ -3,6 +3,7 @@ // Uncomment for SX126X module usage // #define USE_SX126X +// #define WIFI_LoRa_32_V3 // Check your module name at https://github.com/jgromes/RadioLib/wiki/Modules #ifdef USE_SX126X @@ -30,16 +31,16 @@ #endif // Support for heltec_wifi_lora_32_V3 board -// https://github.com/espressif/arduino-esp32/blob/master/variants/heltec_wifi_lora_32_V3/pins_arduino.h -// static const uint8_t RST_LoRa = 12; -// static const uint8_t BUSY_LoRa = 13; -// static const uint8_t DIO0 = 14; +// https://github.com/espressif/arduino-esp32/blob/master/variants/heltec_wireless_stick_lite_v3/pins_arduino.h +//static const uint8_t RST_LoRa = 12; +//static const uint8_t BUSY_LoRa = 13; +//static const uint8_t DIO1 = 14; #ifdef WIFI_LoRa_32_V3 #define LORA_RST RST_LoRa //OK - #define LORA_IRQ 14 //schematic:dio1 include: dio0. Follow schematic ???? + #define LORA_IRQ 14 #define LED_BUILTIN 35 #define BUILTIN_LED 35 #endif @@ -53,18 +54,19 @@ #endif // LoRa pinouts -#define CFG_LORA_PIN_SS SS #define CFG_LORA_PIN_RST LORA_RST #define CFG_LORA_PIN_A LORA_IRQ // (sx127x - dio0, sx126x/sx128x - dio1) #ifdef USE_SX126X #ifdef WIFI_LoRa_32_V3 - #define CFG_LORA_PIN_B BUSY_LoRa // (sx1262 - busy) - #define CFG_LORA_PIN_RXEN RADIOLIB_NC // (sx1262 unused) - #define CFG_LORA_PIN_TXEN RADIOLIB_NC // (sx1262 unused) + #define CFG_LORA_PIN_B BUSY_LoRa + #define CFG_LORA_PIN_RXEN RADIOLIB_NC // (sx1262 unused) + #define CFG_LORA_PIN_TXEN RADIOLIB_NC // (sx1262 unused) + #define CFG_LORA_PIN_SS 8 // NSS_LoRa #else #define CFG_LORA_PIN_B 14 // (sx127x - dio1, sx126x/sx128x - busy) #define CFG_LORA_PIN_RXEN 32 // (sx127x - unused, sx126x - RXEN pin number) #define CFG_LORA_PIN_TXEN 33 // (sx127x - unused, sx126x - TXEN pin number) + #define CFG_LORA_PIN_SS SS #endif #else #define CFG_LORA_PIN_B RADIOLIB_NC @@ -122,7 +124,7 @@ #define CFG_USB_SERIAL_ENABLE false // true - enable KISS communication over USB Serial (e.g. with APRSDroid over USB-OTG), disables USB logging // KISS protocol options -#define CFG_KISS_EXTENSIONS false // true - enable modem control from application with KISS commands and signal reports +#define CFG_KISS_EXTENSIONS true // true - enable modem control from application with KISS commands and signal reports #define CFG_KISS_TCP_IP false // true - run as KISS TCP/IP server, no bluetooth operations performed // APRS-IS options, valid in when CFG_IS_CLIENT_MODE = false diff --git a/platformio.ini b/platformio.ini index 6150836..dccd618 100644 --- a/platformio.ini +++ b/platformio.ini @@ -15,7 +15,6 @@ lib_deps = jgromes/RadioLib @ 6.2.0 rlogiacco/CircularBuffer @ 1.3.3 h2zero/NimBLE-Arduino @1.4.1 -# afpineda/NuS-NimBLE-Serial @ 3.0.1 check_tool = cppcheck check_flags = @@ -80,6 +79,7 @@ build_flags = -D USE_SX126X -D CFG_BT_USE_BLE=true -D USE_NIMBLE + -D WIFI_LoRa_32_V3 [env:heltec-lora32-v3_igate] lib_ignore = @@ -92,4 +92,5 @@ build_flags = -D CFG_IS_CLIENT_MODE=false -D USE_SX126X -D CFG_BT_USE_BLE=true - -D USE_NIMBLE \ No newline at end of file + -D USE_NIMBLE + -D WIFI_LoRa_32_V3 \ No newline at end of file diff --git a/src/loraprs_service.cpp b/src/loraprs_service.cpp index 4265fdd..b86f333 100644 --- a/src/loraprs_service.cpp +++ b/src/loraprs_service.cpp @@ -247,8 +247,13 @@ void Service::setupRig(long loraFreq, long bw, int sf, int cr, int pwr, int sync } rig_->setCRC(crcBytes); rig_->setPreambleLength(config_.LoraPreamble); -#ifdef USE_SX126X - #pragma message("Using SX126X") +#if defined(USE_SX126X) && MODULE_NAME == SX1262 + #pragma message("Using SX1262") + LOG_INFO("Using SX1262 module"); + if (isIsrInstalled_) rig_->clearDio1Action(); + rig_->setDio1Action(onRigIsrRxPacket); + isIsrInstalled_ = true; +#elif defined(USE_SX126X) LOG_INFO("Using SX126X module"); rig_->setRfSwitchPins(config_.LoraPinSwitchRx, config_.LoraPinSwitchTx); if (isIsrInstalled_) rig_->clearDio1Action(); @@ -290,13 +295,22 @@ void Service::setupRigFsk(long freq, float bitRate, float freqDev, float rxBw, i LOG_ERROR("Radio start error:", state); } rig_->disableAddressFiltering(); -#ifdef USE_SX126X + + #if defined(USE_SX126X) && MODULE_NAME == SX1262 + #pragma message("Using SX1262") + LOG_INFO("Using SX1262 module"); + if (isIsrInstalled_) rig_->clearDio1Action(); + rig_->setDio1Action(onRigIsrRxPacket); + isIsrInstalled_ = true; + +#elif defined(USE_SX126X) #pragma message("Using SX126X") LOG_INFO("Using SX126X module"); rig_->setRfSwitchPins(config_.LoraPinSwitchRx, config_.LoraPinSwitchTx); if (isIsrInstalled_) rig_->clearDio1Action(); rig_->setDio1Action(onRigIsrRxPacket); isIsrInstalled_ = true; + #else #pragma message("Using SX127X") LOG_INFO("Using SX127X module");