From c5a3c4d3612d4c9b7b147b777b56add40c5b886e Mon Sep 17 00:00:00 2001 From: jgromes Date: Sun, 23 Apr 2023 22:02:33 +0200 Subject: [PATCH] [nRF24] Fixed variable shadowing --- src/modules/nRF24/nRF24.cpp | 7 +++---- src/modules/nRF24/nRF24.h | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/modules/nRF24/nRF24.cpp b/src/modules/nRF24/nRF24.cpp index 39baa962..62cb2c2d 100644 --- a/src/modules/nRF24/nRF24.cpp +++ b/src/modules/nRF24/nRF24.cpp @@ -304,14 +304,14 @@ int16_t nRF24::setBitRate(float br) { return(state); } -int16_t nRF24::setOutputPower(int8_t power) { +int16_t nRF24::setOutputPower(int8_t pwr) { // set mode to standby int16_t state = standby(); RADIOLIB_ASSERT(state); // check allowed values uint8_t powerRaw = 0; - switch(power) { + switch(pwr) { case -18: powerRaw = RADIOLIB_NRF24_RF_PWR_18_DBM; break; @@ -332,10 +332,9 @@ int16_t nRF24::setOutputPower(int8_t power) { state = this->mod->SPIsetRegValue(RADIOLIB_NRF24_REG_RF_SETUP, powerRaw, 2, 1); if(state == RADIOLIB_ERR_NONE) { - this->power = power; + this->power = pwr; } - return(state); } diff --git a/src/modules/nRF24/nRF24.h b/src/modules/nRF24/nRF24.h index afd68b11..e94a7421 100644 --- a/src/modules/nRF24/nRF24.h +++ b/src/modules/nRF24/nRF24.h @@ -330,10 +330,10 @@ class nRF24: public PhysicalLayer { /*! \brief Sets output power. Allowed values are -18, -12, -6 or 0 dBm. - \param power Output power to be set in dBm. + \param pwr Output power to be set in dBm. \returns \ref status_codes */ - int16_t setOutputPower(int8_t power); + int16_t setOutputPower(int8_t pwr); /*! \brief Sets address width of transmit and receive pipes in bytes. Allowed values are 3, 4 or 5 bytes.