[RF69] Fixes from cppcheck scan
This commit is contained in:
parent
7a8cde1d38
commit
0a53900b51
2 changed files with 23 additions and 30 deletions
|
@ -3,14 +3,6 @@
|
|||
|
||||
RF69::RF69(Module* module) : PhysicalLayer(RF69_FREQUENCY_STEP_SIZE, RF69_MAX_PACKET_LENGTH) {
|
||||
_mod = module;
|
||||
_tempOffset = 0;
|
||||
|
||||
_packetLengthQueried = false;
|
||||
_packetLengthConfig = RF69_PACKET_FORMAT_VARIABLE;
|
||||
|
||||
_promiscuous = false;
|
||||
|
||||
_syncWordLength = 2;
|
||||
}
|
||||
|
||||
int16_t RF69::begin(float freq, float br, float freqDev, float rxBw, int8_t power) {
|
||||
|
@ -245,6 +237,7 @@ int16_t RF69::disableAES() {
|
|||
int16_t RF69::startReceive() {
|
||||
// set mode to standby
|
||||
int16_t state = setMode(RF69_STANDBY);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set RX timeouts and DIO pin mapping
|
||||
state = _mod->SPIsetRegValue(RF69_REG_DIO_MAPPING_1, RF69_DIO0_PACK_PAYLOAD_READY, 7, 4);
|
||||
|
@ -805,13 +798,13 @@ int16_t RF69::config() {
|
|||
|
||||
// set Rx timeouts
|
||||
state = _mod->SPIsetRegValue(RF69_REG_RX_TIMEOUT_1, RF69_TIMEOUT_RX_START, 7, 0);
|
||||
state = _mod->SPIsetRegValue(RF69_REG_RX_TIMEOUT_2, RF69_TIMEOUT_RSSI_THRESH, 7, 0);
|
||||
state |= _mod->SPIsetRegValue(RF69_REG_RX_TIMEOUT_2, RF69_TIMEOUT_RSSI_THRESH, 7, 0);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// enable improved fading margin
|
||||
state = _mod->SPIsetRegValue(RF69_REG_TEST_DAGC, RF69_CONTINUOUS_DAGC_LOW_BETA_OFF, 7, 0);
|
||||
|
||||
return(ERR_NONE);
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t RF69::setPacketMode(uint8_t mode, uint8_t len) {
|
||||
|
|
|
@ -477,7 +477,7 @@ class RF69: public PhysicalLayer {
|
|||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0);
|
||||
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
|
||||
|
||||
/*!
|
||||
\brief Blocking binary receive method.
|
||||
|
@ -489,7 +489,7 @@ class RF69: public PhysicalLayer {
|
|||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t receive(uint8_t* data, size_t len);
|
||||
int16_t receive(uint8_t* data, size_t len) override;
|
||||
|
||||
/*!
|
||||
\brief Sets the module to sleep mode.
|
||||
|
@ -503,7 +503,7 @@ class RF69: public PhysicalLayer {
|
|||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t standby();
|
||||
int16_t standby() override;
|
||||
|
||||
/*!
|
||||
\brief Starts direct mode transmission.
|
||||
|
@ -512,14 +512,14 @@ class RF69: public PhysicalLayer {
|
|||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t transmitDirect(uint32_t frf = 0);
|
||||
int16_t transmitDirect(uint32_t frf = 0) override;
|
||||
|
||||
/*!
|
||||
\brief Starts direct mode reception.
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t receiveDirect();
|
||||
int16_t receiveDirect() override;
|
||||
|
||||
/*!
|
||||
\brief Stops direct mode. It is required to call this method to switch from direct transmissions to packet-based transmissions.
|
||||
|
@ -587,7 +587,7 @@ class RF69: public PhysicalLayer {
|
|||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0);
|
||||
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
|
||||
|
||||
/*!
|
||||
\brief Interrupt-driven receive method. GDO0 will be activated when full packet is received.
|
||||
|
@ -605,7 +605,7 @@ class RF69: public PhysicalLayer {
|
|||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t readData(uint8_t* data, size_t len);
|
||||
int16_t readData(uint8_t* data, size_t len) override;
|
||||
|
||||
// configuration methods
|
||||
|
||||
|
@ -643,7 +643,7 @@ class RF69: public PhysicalLayer {
|
|||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setFrequencyDeviation(float freqDev);
|
||||
int16_t setFrequencyDeviation(float freqDev) override;
|
||||
|
||||
/*!
|
||||
\brief Sets output power. Allowed values range from -18 to 13 dBm for low power modules (RF69C/CW) or -2 to 20 dBm (RF69H/HC/HCW).
|
||||
|
@ -715,7 +715,7 @@ class RF69: public PhysicalLayer {
|
|||
|
||||
\returns Length of last received packet in bytes.
|
||||
*/
|
||||
size_t getPacketLength(bool update = true);
|
||||
size_t getPacketLength(bool update = true) override;
|
||||
|
||||
/*!
|
||||
\brief Set modem in fixed packet length mode.
|
||||
|
@ -777,7 +777,7 @@ class RF69: public PhysicalLayer {
|
|||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setDataShaping(float sh);
|
||||
int16_t setDataShaping(float sh) override;
|
||||
|
||||
/*!
|
||||
\brief Sets transmission encoding.
|
||||
|
@ -786,7 +786,7 @@ class RF69: public PhysicalLayer {
|
|||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setEncoding(uint8_t encoding);
|
||||
int16_t setEncoding(uint8_t encoding) override;
|
||||
|
||||
/*!
|
||||
\brief Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
|
||||
|
@ -810,18 +810,18 @@ class RF69: public PhysicalLayer {
|
|||
#endif
|
||||
Module* _mod;
|
||||
|
||||
float _br;
|
||||
float _rxBw;
|
||||
int16_t _tempOffset;
|
||||
int8_t _power;
|
||||
float _br = 0;
|
||||
float _rxBw = 0;
|
||||
int16_t _tempOffset = 0;
|
||||
int8_t _power = 0;
|
||||
|
||||
size_t _packetLength;
|
||||
bool _packetLengthQueried;
|
||||
uint8_t _packetLengthConfig;
|
||||
size_t _packetLength = 0;
|
||||
bool _packetLengthQueried = false;
|
||||
uint8_t _packetLengthConfig = RF69_PACKET_FORMAT_VARIABLE;
|
||||
|
||||
bool _promiscuous;
|
||||
bool _promiscuous = false;
|
||||
|
||||
uint8_t _syncWordLength;
|
||||
uint8_t _syncWordLength = 2;
|
||||
|
||||
int16_t config();
|
||||
int16_t directMode();
|
||||
|
|
Loading…
Add table
Reference in a new issue