[XBee] Fixes from cppcheck scan

This commit is contained in:
jgromes 2020-07-04 15:03:26 +02:00
parent 7e9686fcaa
commit 57b46386e8
2 changed files with 7 additions and 10 deletions

View file

@ -3,9 +3,6 @@
XBee::XBee(Module* mod) { XBee::XBee(Module* mod) {
_mod = mod; _mod = mod;
_frameID = 0x01;
_frameLength = 0;
_frameHeaderProcessed = false;
} }
int16_t XBee::begin(long speed) { int16_t XBee::begin(long speed) {
@ -97,9 +94,9 @@ size_t XBee::available() {
return(0); return(0);
} }
uint8_t header[3];
if(!_frameHeaderProcessed) { if(!_frameHeaderProcessed) {
// read frame header // read frame header
uint8_t header[3];
for(uint8_t i = 0; i < 3; i++) { for(uint8_t i = 0; i < 3; i++) {
header[i] = _mod->ModuleSerial->read(); header[i] = _mod->ModuleSerial->read();
} }

View file

@ -79,7 +79,7 @@ class XBeeSerial: public ISerial {
\param panId 8-byte PAN ID to be used, in the form of uppercase hexadecimal string (i.e. 16 characters). \param panId 8-byte PAN ID to be used, in the form of uppercase hexadecimal string (i.e. 16 characters).
*/ */
int16_t setPanId(const char* panID); int16_t setPanId(const char* panId);
#ifndef RADIOLIB_GODMODE #ifndef RADIOLIB_GODMODE
private: private:
@ -170,22 +170,22 @@ class XBee {
\param panId 8-byte PAN ID to be used, in the form of uppercase hexadecimal string (i.e. 16 characters). \param panId 8-byte PAN ID to be used, in the form of uppercase hexadecimal string (i.e. 16 characters).
*/ */
int16_t setPanId(uint8_t* panID); int16_t setPanId(uint8_t* panId);
#ifndef RADIOLIB_GODMODE #ifndef RADIOLIB_GODMODE
private: private:
#endif #endif
Module* _mod; Module* _mod;
uint8_t _frameID; uint8_t _frameID = 0x01;
size_t _frameLength; size_t _frameLength = 0;
bool _frameHeaderProcessed; bool _frameHeaderProcessed = false;
#ifdef RADIOLIB_STATIC_ONLY #ifdef RADIOLIB_STATIC_ONLY
char _packetData[RADIOLIB_STATIC_ARRAY_SIZE]; char _packetData[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
char* _packetData = new char[0]; char* _packetData = new char[0];
#endif #endif
uint8_t _packetSource[8]; uint8_t _packetSource[8] = {0, 0, 0, 0, 0, 0, 0, 0};
int16_t confirmChanges(); int16_t confirmChanges();