From bcdf0cfa489c6d0b3cd04fa41a35781307c0485d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20RAILLARD?= Date: Tue, 4 May 2021 00:26:12 +0200 Subject: [PATCH] uint16_t formatting --- RFM69_OTA.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/RFM69_OTA.cpp b/RFM69_OTA.cpp index 1e91837..729bf8a 100644 --- a/RFM69_OTA.cpp +++ b/RFM69_OTA.cpp @@ -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; } }