[Pager] Fixed issues found by cppcheck
This commit is contained in:
parent
48ed06aa4b
commit
89e406775d
2 changed files with 13 additions and 18 deletions
|
@ -28,9 +28,6 @@ PagerClient::PagerClient(PhysicalLayer* phy) {
|
||||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||||
readBitInstance = phyLayer;
|
readBitInstance = phyLayer;
|
||||||
#endif
|
#endif
|
||||||
filterNumAddresses = 0;
|
|
||||||
filterAddresses = NULL;
|
|
||||||
filterMasks = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t PagerClient::begin(float base, uint16_t speed, bool invert, uint16_t shift) {
|
int16_t PagerClient::begin(float base, uint16_t speed, bool invert, uint16_t shift) {
|
||||||
|
@ -206,7 +203,7 @@ int16_t PagerClient::transmit(uint8_t* data, size_t len, uint32_t addr, uint8_t
|
||||||
// in BCD mode, pad the rest of the code word with spaces (0xC)
|
// in BCD mode, pad the rest of the code word with spaces (0xC)
|
||||||
if(encoding == RADIOLIB_PAGER_BCD) {
|
if(encoding == RADIOLIB_PAGER_BCD) {
|
||||||
uint8_t numSteps = (symbolPos - RADIOLIB_PAGER_FUNC_BITS_POS + symbolLength)/symbolLength;
|
uint8_t numSteps = (symbolPos - RADIOLIB_PAGER_FUNC_BITS_POS + symbolLength)/symbolLength;
|
||||||
for(uint8_t i = 0; i < numSteps; i++) {
|
for(uint8_t j = 0; j < numSteps; j++) {
|
||||||
symbol = encodeBCD(' ');
|
symbol = encodeBCD(' ');
|
||||||
symbol = Module::reflect(symbol, 8);
|
symbol = Module::reflect(symbol, 8);
|
||||||
symbol >>= (8 - symbolLength);
|
symbol >>= (8 - symbolLength);
|
||||||
|
@ -397,17 +394,15 @@ int16_t PagerClient::readData(uint8_t* data, size_t* len, uint32_t* addr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// we have the address, start pulling out the message
|
// we have the address, start pulling out the message
|
||||||
bool complete = false;
|
|
||||||
size_t decodedBytes = 0;
|
size_t decodedBytes = 0;
|
||||||
uint32_t prevCw = 0;
|
uint32_t prevCw = 0;
|
||||||
bool overflow = false;
|
bool overflow = false;
|
||||||
int8_t ovfBits = 0;
|
int8_t ovfBits = 0;
|
||||||
while(!complete && phyLayer->available()) {
|
while(phyLayer->available()) {
|
||||||
uint32_t cw = read();
|
uint32_t cw = read();
|
||||||
|
|
||||||
// check if it's the idle code word
|
// check if it's the idle code word
|
||||||
if(cw == RADIOLIB_PAGER_IDLE_CODE_WORD) {
|
if(cw == RADIOLIB_PAGER_IDLE_CODE_WORD) {
|
||||||
complete = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,17 +177,17 @@ class PagerClient {
|
||||||
#endif
|
#endif
|
||||||
PhysicalLayer* phyLayer;
|
PhysicalLayer* phyLayer;
|
||||||
|
|
||||||
float baseFreq;
|
float baseFreq = 0;
|
||||||
float dataRate;
|
float dataRate = 0;
|
||||||
uint32_t baseFreqRaw;
|
uint32_t baseFreqRaw = 0;
|
||||||
uint16_t shiftFreq;
|
uint16_t shiftFreq = 0;
|
||||||
uint16_t shiftFreqHz;
|
uint16_t shiftFreqHz = 0;
|
||||||
RadioLibTime_t bitDuration;
|
RadioLibTime_t bitDuration = 0;
|
||||||
uint32_t filterAddr;
|
uint32_t filterAddr = 0;
|
||||||
uint32_t filterMask;
|
uint32_t filterMask = 0;
|
||||||
uint32_t *filterAddresses;
|
uint32_t *filterAddresses = nullptr;
|
||||||
uint32_t *filterMasks;
|
uint32_t *filterMasks = nullptr;
|
||||||
size_t filterNumAddresses;
|
size_t filterNumAddresses = 0;
|
||||||
bool inv = false;
|
bool inv = false;
|
||||||
|
|
||||||
void write(uint32_t* data, size_t len);
|
void write(uint32_t* data, size_t len);
|
||||||
|
|
Loading…
Add table
Reference in a new issue