From 594fc0cdb235501517723702c86b2beed5b3cabf Mon Sep 17 00:00:00 2001 From: Th3maz1ng Date: Sat, 2 Oct 2021 18:17:32 +0200 Subject: [PATCH] Added the option to enable/disable the LNA (for the NRF modules that have one) --- src/app/WSPeripherals.cpp | 4 ++-- src/app/WSPeripherals.h | 2 +- src/app/definition.h | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/WSPeripherals.cpp b/src/app/WSPeripherals.cpp index 030369d..3fd0c1c 100644 --- a/src/app/WSPeripherals.cpp +++ b/src/app/WSPeripherals.cpp @@ -113,9 +113,9 @@ void WSPeripherals::_3V3PowerRail(State state) const RF24 &WSPeripherals::getRadio(){return _NRF;} -void WSPeripherals::applyRadioConfig(uint8_t channel, uint8_t paLevel, rf24_datarate_e datarate) +void WSPeripherals::applyRadioConfig(uint8_t channel, uint8_t paLevel, bool enableLNA, rf24_datarate_e datarate) { _NRF.setChannel(channel); - _NRF.setPALevel(paLevel); + _NRF.setPALevel(paLevel, enableLNA); _NRF.setDataRate(datarate); } diff --git a/src/app/WSPeripherals.h b/src/app/WSPeripherals.h index 212dd28..39cb8ee 100644 --- a/src/app/WSPeripherals.h +++ b/src/app/WSPeripherals.h @@ -44,7 +44,7 @@ class WSPeripherals /* * Before calling this method, externalPeripherals(ON) and initExternalPeripherals() must be called respectively */ - void applyRadioConfig(uint8_t channel = RADIO_CHANNEL, uint8_t paLevel = RADIO_PA_LEVEL, rf24_datarate_e datarate = RADIO_DATARATE); + void applyRadioConfig(uint8_t channel = RADIO_CHANNEL, uint8_t paLevel = RADIO_PA_LEVEL, bool enableLNA = ENABLE_LNA, rf24_datarate_e datarate = RADIO_DATARATE); const RF24 &getRadio(); protected: diff --git a/src/app/definition.h b/src/app/definition.h index c2e5f54..d786510 100644 --- a/src/app/definition.h +++ b/src/app/definition.h @@ -22,9 +22,11 @@ #define RADIO_CHANNEL 108 #define RADIO_NODE_ADDRESS "WEST1" //Weather Station 1 #define RADIO_PA_LEVEL RF24_PA_LOW //RF24_PA_MIN,RF24_PA_LOW,RF24_PA_HIGH,RF24_PA_MAX +#define ENABLE_LNA false //true or false #define RADIO_DATARATE RF24_250KBPS -//Sleep config part : in 4 second increments ie : 1 corresponds to 4s of sleep, and 15 correponds to 60 seconds of sleep. +//Sleep config part : in 4 second increments ie : 1 corresponds to 4s of sleep, and 15 correponds to 60 seconds of sleep. +//Max is 255 * 4s. #define SLEEP_4_SEC_INTERVAL 15 //Pin config part