Skip to content

Commit

Permalink
uint16_t formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sraillard committed May 3, 2021
1 parent b4f535d commit bcdf0cf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion RFM69_OTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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')
{
uint16_t tmp=0;
sscanf((const char*)radio.DATA, "FLX:%" PRIu16 ":OK", &tmp);
#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);
#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;
}
}
Expand Down

0 comments on commit bcdf0cf

Please sign in to comment.