Merge pull request #165 from sraillard/fix-warnings

fixing some compiler warnings in AVR vs ARM
This commit is contained in:
Felix Rusu 2021-05-03 18:39:25 -04:00 committed by GitHub
commit 551a153a4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -59,7 +59,7 @@ RFM69::RFM69(uint8_t slaveSelectPin, uint8_t interruptPin, bool isRFM69HW, SPICl
bool RFM69::initialize(uint8_t freqBand, uint16_t nodeID, uint8_t networkID) bool RFM69::initialize(uint8_t freqBand, uint16_t nodeID, uint8_t networkID)
{ {
_interruptNum = digitalPinToInterrupt(_interruptPin); _interruptNum = digitalPinToInterrupt(_interruptPin);
if (_interruptNum == NOT_AN_INTERRUPT) return false; if (_interruptNum == (uint8_t)NOT_AN_INTERRUPT) return false;
#ifdef RF69_ATTACHINTERRUPT_TAKES_PIN_NUMBER #ifdef RF69_ATTACHINTERRUPT_TAKES_PIN_NUMBER
_interruptNum = _interruptPin; _interruptNum = _interruptPin;
#endif #endif
@ -552,7 +552,7 @@ void RFM69::setCS(uint8_t newSPISlaveSelect) {
// set the IRQ pin // set the IRQ pin
bool RFM69::setIrq(uint8_t newIRQPin) { bool RFM69::setIrq(uint8_t newIRQPin) {
uint8_t _newInterruptNum = digitalPinToInterrupt(newIRQPin); uint8_t _newInterruptNum = digitalPinToInterrupt(newIRQPin);
if (_newInterruptNum == NOT_AN_INTERRUPT) return false; if (_newInterruptNum == (uint8_t)NOT_AN_INTERRUPT) return false;
#ifdef RF69_ATTACHINTERRUPT_TAKES_PIN_NUMBER #ifdef RF69_ATTACHINTERRUPT_TAKES_PIN_NUMBER
_newInterruptNum = newIRQPin; _newInterruptNum = newIRQPin;
#endif #endif

View File

@ -195,7 +195,7 @@ class RFM69 {
static int16_t RSSI; // most accurate RSSI during reception (closest to the reception). RSSI of last packet. static int16_t RSSI; // most accurate RSSI during reception (closest to the reception). RSSI of last packet.
static uint8_t _mode; // should be protected? static uint8_t _mode; // should be protected?
RFM69(uint8_t slaveSelectPin, uint8_t interruptPin, bool isRFM69HW, uint8_t interruptNum) //interruptNum is now deprecated RFM69(uint8_t slaveSelectPin, uint8_t interruptPin, bool isRFM69HW, uint8_t interruptNum __attribute__((unused))) //interruptNum is now deprecated
: RFM69(slaveSelectPin, interruptPin, isRFM69HW){}; : RFM69(slaveSelectPin, interruptPin, isRFM69HW){};
RFM69(uint8_t slaveSelectPin=RF69_SPI_CS, uint8_t interruptPin=RF69_IRQ_PIN, bool isRFM69HW=false, SPIClass *spi=nullptr); RFM69(uint8_t slaveSelectPin=RF69_SPI_CS, uint8_t interruptPin=RF69_IRQ_PIN, bool isRFM69HW=false, SPIClass *spi=nullptr);
@ -238,7 +238,7 @@ class RFM69 {
protected: protected:
static void isr0(); static void isr0();
void interruptHandler(); void interruptHandler();
virtual void interruptHook(uint8_t CTLbyte) {}; virtual void interruptHook(uint8_t CTLbyte __attribute__((unused))) {};
static volatile bool _haveData; static volatile bool _haveData;
virtual void sendFrame(uint16_t toAddress, const void* buffer, uint8_t size, bool requestACK=false, bool sendACK=false); virtual void sendFrame(uint16_t toAddress, const void* buffer, uint8_t size, bool requestACK=false, bool sendACK=false);

View File

@ -510,7 +510,13 @@ uint8_t sendHEXPacket(RFM69& radio, uint16_t targetID, uint8_t* sendBuf, uint8_t
radio.DATA[ackLen-2]=='O' && radio.DATA[ackLen-1]=='K') radio.DATA[ackLen-2]=='O' && radio.DATA[ackLen-1]=='K')
{ {
uint16_t tmp=0; uint16_t tmp=0;
#if defined(__arm__)
// On the ARM platform, uint16_t = short unsigned int, so %hu formatting is needed:
sscanf((const char*)radio.DATA, "FLX:%hu:OK", &tmp); sscanf((const char*)radio.DATA, "FLX:%hu:OK", &tmp);
#else
// On the AVR platform, uint16_t = unsigned int, so %u formatting is needed:
sscanf((const char*)radio.DATA, "FLX:%u:OK", &tmp);
#endif
return tmp == seq; return tmp == seq;
} }
} }