kopia lustrzana https://github.com/sh123/esp32_loraprs
Take module name from file
rodzic
b2a39d876c
commit
952c2f1a3c
|
@ -7,7 +7,7 @@ byte Service::rxBuf_[256];
|
||||||
#ifdef USE_RADIOLIB
|
#ifdef USE_RADIOLIB
|
||||||
#pragma message("Using RadioLib")
|
#pragma message("Using RadioLib")
|
||||||
bool Service::interruptEnabled_ = true;
|
bool Service::interruptEnabled_ = true;
|
||||||
std::shared_ptr<SX1278> Service::radio_;
|
std::shared_ptr<MODULE_NAME> Service::radio_;
|
||||||
#else
|
#else
|
||||||
#pragma message("Using arduino-LoRa")
|
#pragma message("Using arduino-LoRa")
|
||||||
#endif
|
#endif
|
||||||
|
@ -167,7 +167,7 @@ void Service::setupLora(long loraFreq, long bw, int sf, int cr, int pwr, int syn
|
||||||
isImplicitHeaderMode_ = sf == 6;
|
isImplicitHeaderMode_ = sf == 6;
|
||||||
|
|
||||||
#ifdef USE_RADIOLIB
|
#ifdef USE_RADIOLIB
|
||||||
radio_ = std::make_shared<SX1278>(new Module(config_.LoraPinSs, config_.LoraPinDio0, config_.LoraPinRst, RADIOLIB_NC));
|
radio_ = std::make_shared<MODULE_NAME>(new Module(config_.LoraPinSs, config_.LoraPinDio0, config_.LoraPinRst, RADIOLIB_NC));
|
||||||
int state = radio_->begin((float)loraFreq / 1e6, (float)bw / 1e3, sf, cr, sync, pwr);
|
int state = radio_->begin((float)loraFreq / 1e6, (float)bw / 1e3, sf, cr, sync, pwr);
|
||||||
if (state != ERR_NONE) {
|
if (state != ERR_NONE) {
|
||||||
LOG_ERROR("Radio start error:", state);
|
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_->forceLDRO(false);
|
||||||
//radio_->setRfSwitchPins(4, 5);
|
//radio_->setRfSwitchPins(4, 5);
|
||||||
|
|
||||||
|
#if MODULE_NAME == SX1268
|
||||||
|
radio_->clearDio1Action();
|
||||||
|
radio_->setDio1Action(onLoraDataAvailableIsr);
|
||||||
|
#else
|
||||||
radio_->clearDio0Action();
|
radio_->clearDio0Action();
|
||||||
radio_->setDio0Action(onLoraDataAvailableIsr);
|
radio_->setDio0Action(onLoraDataAvailableIsr);
|
||||||
|
#endif
|
||||||
state = radio_->startReceive();
|
state = radio_->startReceive();
|
||||||
if (state != ERR_NONE) {
|
if (state != ERR_NONE) {
|
||||||
LOG_ERROR("Receive start error:", state);
|
LOG_ERROR("Receive start error:", state);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#ifdef USE_RADIOLIB
|
#ifdef USE_RADIOLIB
|
||||||
#include <RadioLib.h>
|
#include <RadioLib.h>
|
||||||
|
#include "module.h"
|
||||||
#else
|
#else
|
||||||
#include <LoRa.h>
|
#include <LoRa.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,7 +146,7 @@ private:
|
||||||
#ifdef USE_RADIOLIB
|
#ifdef USE_RADIOLIB
|
||||||
static bool interruptEnabled_;
|
static bool interruptEnabled_;
|
||||||
CircularBuffer<uint8_t, 256> txQueue_;
|
CircularBuffer<uint8_t, 256> txQueue_;
|
||||||
static std::shared_ptr<SX1278> radio_;
|
static std::shared_ptr<MODULE_NAME> radio_;
|
||||||
#endif
|
#endif
|
||||||
BluetoothSerial serialBt_;
|
BluetoothSerial serialBt_;
|
||||||
BLESerial serialBLE_;
|
BLESerial serialBLE_;
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Check your module name at https://github.com/jgromes/RadioLib/wiki/Modules
|
||||||
|
#define MODULE_NAME SX1278
|
Ładowanie…
Reference in New Issue