diff --git a/loraprs_service.cpp b/loraprs_service.cpp index b6f47cb..7fb8466 100644 --- a/loraprs_service.cpp +++ b/loraprs_service.cpp @@ -7,7 +7,7 @@ byte Service::rxBuf_[256]; #ifdef USE_RADIOLIB #pragma message("Using RadioLib") bool Service::interruptEnabled_ = true; -std::shared_ptr Service::radio_; +std::shared_ptr Service::radio_; #else #pragma message("Using arduino-LoRa") #endif @@ -167,7 +167,7 @@ void Service::setupLora(long loraFreq, long bw, int sf, int cr, int pwr, int syn isImplicitHeaderMode_ = sf == 6; #ifdef USE_RADIOLIB - radio_ = std::make_shared(new Module(config_.LoraPinSs, config_.LoraPinDio0, config_.LoraPinRst, RADIOLIB_NC)); + radio_ = std::make_shared(new Module(config_.LoraPinSs, config_.LoraPinDio0, config_.LoraPinRst, RADIOLIB_NC)); int state = radio_->begin((float)loraFreq / 1e6, (float)bw / 1e3, sf, cr, sync, pwr); if (state != ERR_NONE) { LOG_ERROR("Radio start error:", state); @@ -176,9 +176,13 @@ void Service::setupLora(long loraFreq, long bw, int sf, int cr, int pwr, int syn //radio_->forceLDRO(false); //radio_->setRfSwitchPins(4, 5); +#if MODULE_NAME == SX1268 + radio_->clearDio1Action(); + radio_->setDio1Action(onLoraDataAvailableIsr); +#else radio_->clearDio0Action(); radio_->setDio0Action(onLoraDataAvailableIsr); - +#endif state = radio_->startReceive(); if (state != ERR_NONE) { LOG_ERROR("Receive start error:", state); diff --git a/loraprs_service.h b/loraprs_service.h index 44b22b8..4d1aedb 100644 --- a/loraprs_service.h +++ b/loraprs_service.h @@ -13,6 +13,7 @@ #ifdef USE_RADIOLIB #include +#include "module.h" #else #include #endif @@ -145,7 +146,7 @@ private: #ifdef USE_RADIOLIB static bool interruptEnabled_; CircularBuffer txQueue_; - static std::shared_ptr radio_; + static std::shared_ptr radio_; #endif BluetoothSerial serialBt_; BLESerial serialBLE_; diff --git a/module.h b/module.h new file mode 100644 index 0000000..ee8c7b0 --- /dev/null +++ b/module.h @@ -0,0 +1,2 @@ +// Check your module name at https://github.com/jgromes/RadioLib/wiki/Modules +#define MODULE_NAME SX1278