From 220b4dad7fa4ae7520f93e74df49bb4c6f050b46 Mon Sep 17 00:00:00 2001 From: Mestery Date: Sun, 9 Apr 2023 23:47:44 +0200 Subject: [PATCH] use printf in both build --- src/BuildOpt.h | 31 ++++++-- src/Module.cpp | 71 ++++++++----------- src/modules/CC1101/CC1101.cpp | 20 ++---- src/modules/RF69/RF69.cpp | 16 +---- src/modules/RFM9x/RFM95.cpp | 8 +-- src/modules/RFM9x/RFM96.cpp | 8 +-- src/modules/SX1231/SX1231.cpp | 18 ++--- src/modules/SX126x/SX126x.cpp | 47 +++++------- src/modules/SX127x/SX1272.cpp | 8 +-- src/modules/SX127x/SX1278.cpp | 8 +-- src/modules/SX127x/SX127x.cpp | 20 ++---- src/modules/SX128x/SX128x.cpp | 16 ++--- src/modules/Si443x/Si4430.cpp | 2 +- src/modules/Si443x/Si4431.cpp | 2 +- src/modules/Si443x/Si4432.cpp | 2 +- src/modules/Si443x/Si443x.cpp | 32 ++------- src/modules/nRF24/nRF24.cpp | 4 +- src/protocols/Morse/Morse.cpp | 14 ++-- src/protocols/Pager/Pager.cpp | 4 +- src/protocols/PhysicalLayer/PhysicalLayer.cpp | 8 +-- 20 files changed, 127 insertions(+), 212 deletions(-) diff --git a/src/BuildOpt.h b/src/BuildOpt.h index c6b0583d..0c02b351 100644 --- a/src/BuildOpt.h +++ b/src/BuildOpt.h @@ -1040,14 +1040,37 @@ #if defined(RADIOLIB_DEBUG) #if defined(RADIOLIB_BUILD_ARDUINO) - #define RADIOLIB_DEBUG_PRINT(...) { RADIOLIB_DEBUG_PORT.print(__VA_ARGS__); } - #define RADIOLIB_DEBUG_PRINTLN(...) { RADIOLIB_DEBUG_PORT.println(__VA_ARGS__); } +// https://github.com/esp8266/Arduino/blob/65579d29081cb8501e4d7f786747bf12e7b37da2/cores/esp8266/Print.cpp#L50 +size_t serialPrintf(const char *format, ...) { + va_list arg; + va_start(arg, format); + char temp[64]; + char* buffer = temp; + size_t len = vsnprintf(temp, sizeof(temp), format, arg); + va_end(arg); + if (len > sizeof(temp) - 1) { + buffer = new char[len + 1]; + if (!buffer) { + return 0; + } + va_start(arg, format); + vsnprintf(buffer, len + 1, format, arg); + va_end(arg); + } + len = RADIOLIB_DEBUG_PORT.write((const uint8_t*) buffer, len); + if (buffer != temp) { + delete[] buffer; + } + return len; +} + #define RADIOLIB_DEBUG_PRINT(...) serialPrintf(__VA_ARGS__) + #define RADIOLIB_DEBUG_PRINTLN(M, ...) serialPrintf(M "\n", ##__VA_ARGS__) #else #if !defined(RADIOLIB_DEBUG_PRINT) - #define RADIOLIB_DEBUG_PRINT(...) { fprintf(RADIOLIB_DEBUG_PORT, __VA_ARGS__); } + #define RADIOLIB_DEBUG_PRINT(...) fprintf(RADIOLIB_DEBUG_PORT, __VA_ARGS__) #endif #if !defined(RADIOLIB_DEBUG_PRINTLN) - #define RADIOLIB_DEBUG_PRINTLN(...) { fprintf(RADIOLIB_DEBUG_PORT, __VA_ARGS__ "\n"); } + #define RADIOLIB_DEBUG_PRINTLN(M, ...) fprintf(RADIOLIB_DEBUG_PORT, M "\n", ##__VA_ARGS__) #endif #endif #else diff --git a/src/Module.cpp b/src/Module.cpp index df60214f..77e4906d 100644 --- a/src/Module.cpp +++ b/src/Module.cpp @@ -160,24 +160,26 @@ int16_t Module::SPIsetRegValue(uint16_t reg, uint8_t value, uint8_t msb, uint8_t } } + #if defined(RADIOLIB_DEBUG) && defined(RADIOLIB_BUILD_ARDUINO) + #define DEBUG_BIN(x) RADIOLIB_DEBUG_PORT.println(x, BIN) + #else // no bin representation, fallback to hex + #define DEBUG_BIN(x) RADIOLIB_DEBUG_PRINTLN("%X", x) + #endif + // check failed, print debug info RADIOLIB_DEBUG_PRINTLN(); - RADIOLIB_DEBUG_PRINT(F("address:\t0x")); - RADIOLIB_DEBUG_PRINTLN(reg, HEX); - RADIOLIB_DEBUG_PRINT(F("bits:\t\t")); - RADIOLIB_DEBUG_PRINT(msb); - RADIOLIB_DEBUG_PRINT(' '); - RADIOLIB_DEBUG_PRINTLN(lsb); - RADIOLIB_DEBUG_PRINT(F("value:\t\t0b")); - RADIOLIB_DEBUG_PRINTLN(value, BIN); - RADIOLIB_DEBUG_PRINT(F("current:\t0b")); - RADIOLIB_DEBUG_PRINTLN(currentValue, BIN); - RADIOLIB_DEBUG_PRINT(F("mask:\t\t0b")); - RADIOLIB_DEBUG_PRINTLN(mask, BIN); - RADIOLIB_DEBUG_PRINT(F("new:\t\t0b")); - RADIOLIB_DEBUG_PRINTLN(newValue, BIN); - RADIOLIB_DEBUG_PRINT(F("read:\t\t0b")); - RADIOLIB_DEBUG_PRINTLN(readValue, BIN); + RADIOLIB_DEBUG_PRINTLN("address:\t0x%X", reg); + RADIOLIB_DEBUG_PRINTLN("bits:\t\t%d %d", msb, lsb); + RADIOLIB_DEBUG_PRINT("value:\t\t0b"); + DEBUG_BIN(value); + RADIOLIB_DEBUG_PRINT("current:\t0b"); + DEBUG_BIN(currentValue); + RADIOLIB_DEBUG_PRINT("mask:\t\t0b"); + DEBUG_BIN(mask); + RADIOLIB_DEBUG_PRINT("new:\t\t0b"); + DEBUG_BIN(newValue); + RADIOLIB_DEBUG_PRINT("read:\t\t0b"); + DEBUG_BIN(readValue); RADIOLIB_DEBUG_PRINTLN(); return(RADIOLIB_ERR_SPI_WRITE_FAILED); @@ -241,13 +243,11 @@ void Module::SPItransfer(uint8_t cmd, uint16_t reg, uint8_t* dataOut, uint8_t* d #if defined(RADIOLIB_VERBOSE) if(cmd == SPIwriteCommand) { - RADIOLIB_VERBOSE_PRINT('W'); + RADIOLIB_VERBOSE_PRINT("W"); } else if(cmd == SPIreadCommand) { - RADIOLIB_VERBOSE_PRINT('R'); + RADIOLIB_VERBOSE_PRINT("R"); } - RADIOLIB_VERBOSE_PRINT('\t') - RADIOLIB_VERBOSE_PRINT(reg, HEX); - RADIOLIB_VERBOSE_PRINT('\t'); + RADIOLIB_VERBOSE_PRINT("\t%X\t", reg); #endif // send data or get response @@ -255,16 +255,14 @@ void Module::SPItransfer(uint8_t cmd, uint16_t reg, uint8_t* dataOut, uint8_t* d if(dataOut != NULL) { for(size_t n = 0; n < numBytes; n++) { this->transfer(dataOut[n]); - RADIOLIB_VERBOSE_PRINT(dataOut[n], HEX); - RADIOLIB_VERBOSE_PRINT('\t'); + RADIOLIB_VERBOSE_PRINT("%X\t", dataOut[n]); } } } else if (cmd == SPIreadCommand) { if(dataIn != NULL) { for(size_t n = 0; n < numBytes; n++) { dataIn[n] = this->transfer(0x00); - RADIOLIB_VERBOSE_PRINT(dataIn[n], HEX); - RADIOLIB_VERBOSE_PRINT('\t'); + RADIOLIB_VERBOSE_PRINT("%X\t", dataIn[n]); } } } @@ -419,8 +417,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint // print command byte(s) RADIOLIB_VERBOSE_PRINT("CMD\t"); for(uint8_t n = 0; n < cmdLen; n++) { - RADIOLIB_VERBOSE_PRINT(cmd[n], HEX); - RADIOLIB_VERBOSE_PRINT('\t'); + RADIOLIB_VERBOSE_PRINT("%X\t", cmd[n]); } RADIOLIB_VERBOSE_PRINTLN(); @@ -429,25 +426,14 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint if(write) { RADIOLIB_VERBOSE_PRINT("W\t"); for(size_t n = 0; n < numBytes; n++) { - RADIOLIB_VERBOSE_PRINT(dataOut[n], HEX); - RADIOLIB_VERBOSE_PRINT('\t'); - RADIOLIB_VERBOSE_PRINT(debugBuff[n], HEX); - RADIOLIB_VERBOSE_PRINT('\t'); + RADIOLIB_VERBOSE_PRINT("%X\t%X\t", dataOut[n], debugBuff[n]); } RADIOLIB_VERBOSE_PRINTLN(); } else { - RADIOLIB_VERBOSE_PRINT("R\t"); - // skip the first byte for read-type commands (status-only) - RADIOLIB_VERBOSE_PRINT(this->SPInopCommand, HEX); - RADIOLIB_VERBOSE_PRINT('\t'); - RADIOLIB_VERBOSE_PRINT(debugBuff[0], HEX); - RADIOLIB_VERBOSE_PRINT('\t') + RADIOLIB_VERBOSE_PRINT("R\t%X\t%X\t", this->SPInopCommand, debugBuff[0]); for(size_t n = 0; n < numBytes; n++) { - RADIOLIB_VERBOSE_PRINT(this->SPInopCommand, HEX); - RADIOLIB_VERBOSE_PRINT('\t'); - RADIOLIB_VERBOSE_PRINT(dataIn[n], HEX); - RADIOLIB_VERBOSE_PRINT('\t'); + RADIOLIB_VERBOSE_PRINT("%X\t%X\t", this->SPInopCommand, dataIn[n]); } RADIOLIB_VERBOSE_PRINTLN(); } @@ -752,7 +738,8 @@ void Module::hexdump(uint8_t* data, size_t len, uint32_t offset, uint8_t width, for(size_t j = line_len; j < 16; j++) { sprintf(&str[58 + j], " "); } - RADIOLIB_DEBUG_PRINTLN(str); + RADIOLIB_DEBUG_PRINT(str); + RADIOLIB_DEBUG_PRINTLN(); rem_len -= 16; } } diff --git a/src/modules/CC1101/CC1101.cpp b/src/modules/CC1101/CC1101.cpp index 3ab475de..252ca8a2 100644 --- a/src/modules/CC1101/CC1101.cpp +++ b/src/modules/CC1101/CC1101.cpp @@ -24,28 +24,18 @@ int16_t CC1101::begin(float freq, float br, float freqDev, float rxBw, int8_t po if((version == RADIOLIB_CC1101_VERSION_CURRENT) || (version == RADIOLIB_CC1101_VERSION_LEGACY) || (version == RADIOLIB_CC1101_VERSION_CLONE)) { flagFound = true; } else { - #if defined(RADIOLIB_DEBUG) - RADIOLIB_DEBUG_PRINT(F("CC1101 not found! (")); - RADIOLIB_DEBUG_PRINT(i + 1); - RADIOLIB_DEBUG_PRINT(F(" of 10 tries) RADIOLIB_CC1101_REG_VERSION == ")); - - char buffHex[7]; - sprintf(buffHex, "0x%04X", version); - RADIOLIB_DEBUG_PRINT(buffHex); - RADIOLIB_DEBUG_PRINT(F(", expected 0x0004/0x0014")); - RADIOLIB_DEBUG_PRINTLN(); - #endif + RADIOLIB_DEBUG_PRINTLN("CC1101 not found! (%d of 10 tries) RADIOLIB_CC1101_REG_VERSION == 0x%04X, expected 0x0004/0x0014", i + 1, version); _mod->delay(10); i++; } } if(!flagFound) { - RADIOLIB_DEBUG_PRINTLN(F("No CC1101 found!")); + RADIOLIB_DEBUG_PRINTLN("No CC1101 found!"); _mod->term(); return(RADIOLIB_ERR_CHIP_NOT_FOUND); } else { - RADIOLIB_DEBUG_PRINTLN(F("M\tCC1101")); + RADIOLIB_DEBUG_PRINTLN("M\tCC1101"); } // configure settings not accessible by API @@ -388,7 +378,7 @@ int16_t CC1101::readData(uint8_t* data, size_t len) { if (bytesInFIFO == 0) { if (millis() - lastPop > 5) { // readData was required to read a packet longer than the one received. - RADIOLIB_DEBUG_PRINTLN(F("No data for more than 5mS. Stop here.")); + RADIOLIB_DEBUG_PRINTLN("No data for more than 5mS. Stop here."); break; } else { delay(1); @@ -919,7 +909,7 @@ void CC1101::setRfSwitchTable(const RADIOLIB_PIN_TYPE (&pins)[Module::RFSWITCH_M uint8_t CC1101::randomByte() { // set mode to Rx SPIsendCommand(RADIOLIB_CC1101_CMD_RX); - RADIOLIB_DEBUG_PRINTLN("random"); + RADIOLIB_DEBUG_PRINTLN("CC1101::randomByte"); // wait a bit for the RSSI reading to stabilise _mod->delay(10); diff --git a/src/modules/RF69/RF69.cpp b/src/modules/RF69/RF69.cpp index 45f53203..a33e245f 100644 --- a/src/modules/RF69/RF69.cpp +++ b/src/modules/RF69/RF69.cpp @@ -26,28 +26,18 @@ int16_t RF69::begin(float freq, float br, float freqDev, float rxBw, int8_t powe if(version == RADIOLIB_RF69_CHIP_VERSION) { flagFound = true; } else { - #if defined(RADIOLIB_DEBUG) - RADIOLIB_DEBUG_PRINT(F("RF69 not found! (")); - RADIOLIB_DEBUG_PRINT(i + 1); - RADIOLIB_DEBUG_PRINT(F(" of 10 tries) RADIOLIB_RF69_REG_VERSION == ")); - - char buffHex[7]; - sprintf(buffHex, "0x%04X", version); - RADIOLIB_DEBUG_PRINT(buffHex); - RADIOLIB_DEBUG_PRINT(F(", expected 0x0024")); - RADIOLIB_DEBUG_PRINTLN(); - #endif + RADIOLIB_DEBUG_PRINTLN("RF69 not found! (%d of 10 tries) RADIOLIB_RF69_REG_VERSION == 0x%04X, expected 0x0024", i + 1, version); _mod->delay(10); i++; } } if(!flagFound) { - RADIOLIB_DEBUG_PRINTLN(F("No RF69 found!")); + RADIOLIB_DEBUG_PRINTLN("No RF69 found!"); _mod->term(); return(RADIOLIB_ERR_CHIP_NOT_FOUND); } else { - RADIOLIB_DEBUG_PRINTLN(F("M\tRF69")); + RADIOLIB_DEBUG_PRINTLN("M\tRF69"); } // configure settings not accessible by API diff --git a/src/modules/RFM9x/RFM95.cpp b/src/modules/RFM9x/RFM95.cpp index 640645da..892fc53c 100644 --- a/src/modules/RFM9x/RFM95.cpp +++ b/src/modules/RFM9x/RFM95.cpp @@ -16,8 +16,8 @@ int16_t RFM95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncW // some other error return(state); } - RADIOLIB_DEBUG_PRINTLN(F("M\tSX1278")); - RADIOLIB_DEBUG_PRINTLN(F("M\tRFM95")); + RADIOLIB_DEBUG_PRINTLN("M\tSX1278"); + RADIOLIB_DEBUG_PRINTLN("M\tRFM95"); // configure publicly accessible settings state = setBandwidth(bw); @@ -51,8 +51,8 @@ int16_t RFM95::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t // some other error return(state); } - RADIOLIB_DEBUG_PRINTLN(F("M\tSX1278")); - RADIOLIB_DEBUG_PRINTLN(F("M\tRFM95")); + RADIOLIB_DEBUG_PRINTLN("M\tSX1278"); + RADIOLIB_DEBUG_PRINTLN("M\tRFM95"); // configure settings not accessible by API state = configFSK(); diff --git a/src/modules/RFM9x/RFM96.cpp b/src/modules/RFM9x/RFM96.cpp index 78427b71..2f7f451a 100644 --- a/src/modules/RFM9x/RFM96.cpp +++ b/src/modules/RFM9x/RFM96.cpp @@ -16,8 +16,8 @@ int16_t RFM96::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncW // some other error return(state); } - RADIOLIB_DEBUG_PRINTLN(F("M\tSX1278")); - RADIOLIB_DEBUG_PRINTLN(F("M\tRFM96")); + RADIOLIB_DEBUG_PRINTLN("M\tSX1278"); + RADIOLIB_DEBUG_PRINTLN("M\tRFM96"); // configure publicly accessible settings state = setBandwidth(bw); @@ -52,8 +52,8 @@ int16_t RFM96::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t // some other error return(state); } - RADIOLIB_DEBUG_PRINTLN(F("M\tSX1278")); - RADIOLIB_DEBUG_PRINTLN(F("M\tRFM96")); + RADIOLIB_DEBUG_PRINTLN("M\tSX1278"); + RADIOLIB_DEBUG_PRINTLN("M\tRFM96"); // configure settings not accessible by API state = configFSK(); diff --git a/src/modules/SX1231/SX1231.cpp b/src/modules/SX1231/SX1231.cpp index c3e750c9..8e81d892 100644 --- a/src/modules/SX1231/SX1231.cpp +++ b/src/modules/SX1231/SX1231.cpp @@ -20,33 +20,23 @@ int16_t SX1231::begin(float freq, float br, float freqDev, float rxBw, int8_t po flagFound = true; _chipRevision = version; } else { - #if defined(RADIOLIB_DEBUG) - RADIOLIB_DEBUG_PRINT(F("SX1231 not found! (")); - RADIOLIB_DEBUG_PRINT(i + 1); - RADIOLIB_DEBUG_PRINT(F(" of 10 tries) RF69_REG_VERSION == ")); - - char buffHex[12]; - sprintf(buffHex, "0x%04X", version); - RADIOLIB_DEBUG_PRINT(buffHex); - RADIOLIB_DEBUG_PRINT(F(", expected 0x0021 / 0x0022 / 0x0023")); - RADIOLIB_DEBUG_PRINTLN(); - #endif + RADIOLIB_DEBUG_PRINTLN("SX1231 not found! (%d of 10 tries) RF69_REG_VERSION == 0x%04X, expected 0x0021 / 0x0022 / 0x0023", i + 1, version); _mod->delay(10); i++; } } if(!flagFound) { - RADIOLIB_DEBUG_PRINTLN(F("No SX1231 found!")); + RADIOLIB_DEBUG_PRINTLN("No SX1231 found!"); _mod->term(); return(RADIOLIB_ERR_CHIP_NOT_FOUND); } - RADIOLIB_DEBUG_PRINTLN(F("M\tSX1231")); + RADIOLIB_DEBUG_PRINTLN("M\tSX1231"); // configure settings not accessible by API int16_t state = config(); RADIOLIB_ASSERT(state); - RADIOLIB_DEBUG_PRINTLN(F("M\tRF69")); + RADIOLIB_DEBUG_PRINTLN("M\tRF69"); // configure publicly accessible settings state = setFrequency(freq); diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp index 5288153a..b5ed7188 100644 --- a/src/modules/SX126x/SX126x.cpp +++ b/src/modules/SX126x/SX126x.cpp @@ -24,11 +24,11 @@ int16_t SX126x::begin(uint8_t cr, uint8_t syncWord, uint16_t preambleLength, flo // try to find the SX126x chip if(!SX126x::findChip(_chipType)) { - RADIOLIB_DEBUG_PRINTLN(F("No SX126x found!")); + RADIOLIB_DEBUG_PRINTLN("No SX126x found!"); _mod->term(); return(RADIOLIB_ERR_CHIP_NOT_FOUND); } - RADIOLIB_DEBUG_PRINTLN(F("M\tSX126x")); + RADIOLIB_DEBUG_PRINTLN("M\tSX126x"); // BW in kHz and SF are required in order to calculate LDRO for setModulationParams // set the defaults, this will get overwritten later anyway @@ -106,11 +106,11 @@ int16_t SX126x::beginFSK(float br, float freqDev, float rxBw, uint16_t preambleL // try to find the SX126x chip if(!SX126x::findChip(_chipType)) { - RADIOLIB_DEBUG_PRINTLN(F("No SX126x found!")); + RADIOLIB_DEBUG_PRINTLN("No SX126x found!"); _mod->term(); return(RADIOLIB_ERR_CHIP_NOT_FOUND); } - RADIOLIB_DEBUG_PRINTLN(F("M\tSX126x")); + RADIOLIB_DEBUG_PRINTLN("M\tSX126x"); // initialize configuration variables (will be overwritten during public settings configuration) _br = 21333; // 48.0 kbps @@ -245,9 +245,7 @@ int16_t SX126x::transmit(uint8_t* data, size_t len, uint8_t addr) { return(RADIOLIB_ERR_UNKNOWN); } - RADIOLIB_DEBUG_PRINT(F("Timeout in ")); - RADIOLIB_DEBUG_PRINT(timeout); - RADIOLIB_DEBUG_PRINTLN(F(" us")); + RADIOLIB_DEBUG_PRINTLN("Timeout in %d us", timeout); // start transmission state = startTransmit(data, len, addr); @@ -296,9 +294,7 @@ int16_t SX126x::receive(uint8_t* data, size_t len) { return(RADIOLIB_ERR_UNKNOWN); } - RADIOLIB_DEBUG_PRINT(F("Timeout in ")); - RADIOLIB_DEBUG_PRINT(timeout); - RADIOLIB_DEBUG_PRINTLN(F(" us")); + RADIOLIB_DEBUG_PRINTLN("Timeout in %d us", timeout); // start reception uint32_t timeoutValue = (uint32_t)((float)timeout / 15.625); @@ -594,8 +590,7 @@ int16_t SX126x::startReceiveDutyCycleAuto(uint16_t senderPreambleLength, uint16_ uint32_t symbolLength = ((uint32_t)(10 * 1000) << _sf) / (10 * _bwKhz); uint32_t sleepPeriod = symbolLength * sleepSymbols; - RADIOLIB_DEBUG_PRINT(F("Auto sleep period: ")); - RADIOLIB_DEBUG_PRINTLN(sleepPeriod); + RADIOLIB_DEBUG_PRINTLN("Auto sleep period: %d", sleepPeriod); // when the unit detects a preamble, it starts a timer that will timeout if it doesn't receive a header in time. // the duration is sleepPeriod + 2 * wakePeriod. @@ -606,8 +601,7 @@ int16_t SX126x::startReceiveDutyCycleAuto(uint16_t senderPreambleLength, uint16_ uint32_t wakePeriod = max( (symbolLength * (senderPreambleLength + 1) - (sleepPeriod - 1000)) / 2, // (A) symbolLength * (minSymbols + 1)); //(B) - RADIOLIB_DEBUG_PRINT(F("Auto wake period: ")); - RADIOLIB_DEBUG_PRINTLN(wakePeriod); + RADIOLIB_DEBUG_PRINTLN("Auto wake period: ", wakePeriod); // If our sleep period is shorter than our transition time, just use the standard startReceive if(sleepPeriod < _tcxoDelay + 1016) { @@ -1451,8 +1445,7 @@ int16_t SX126x::uploadPatch(const uint32_t* patch, size_t len, bool nonvolatile) #if defined(RADIOLIB_DEBUG) char ver_pre[16]; _mod->SPIreadRegisterBurst(RADIOLIB_SX126X_REG_VERSION_STRING, 16, (uint8_t*)ver_pre); - RADIOLIB_DEBUG_PRINT(F("Pre-update version string: ")); - RADIOLIB_DEBUG_PRINTLN(ver_pre); + RADIOLIB_DEBUG_PRINTLN("Pre-update version string: %d", ver_pre); #endif // enable patch update @@ -1484,8 +1477,7 @@ int16_t SX126x::uploadPatch(const uint32_t* patch, size_t len, bool nonvolatile) #if defined(RADIOLIB_DEBUG) char ver_post[16]; _mod->SPIreadRegisterBurst(RADIOLIB_SX126X_REG_VERSION_STRING, 16, (uint8_t*)ver_post); - RADIOLIB_DEBUG_PRINT(F("Post-update version string: ")); - RADIOLIB_DEBUG_PRINTLN(ver_post); + RADIOLIB_DEBUG_PRINTLN("Post-update version string: %d", ver_post); #endif return(state); @@ -1712,8 +1704,7 @@ int16_t SX126x::calibrateImage(uint8_t* data) { // unless mode is forced to standby, device errors will be 0 standby(); uint16_t errors = getDeviceErrors(); - RADIOLIB_DEBUG_PRINT("Calibration failed, device errors: 0x"); - RADIOLIB_DEBUG_PRINTLN(errors, HEX); + RADIOLIB_DEBUG_PRINTLN("Calibration failed, device errors: 0x%X", errors); } #endif return(state); @@ -1766,9 +1757,7 @@ int16_t SX126x::setModulationParams(uint8_t sf, uint8_t bw, uint8_t cr, uint8_t // calculate symbol length and enable low data rate optimization, if auto-configuration is enabled if(_ldroAuto) { float symbolLength = (float)(uint32_t(1) << _sf) / (float)_bwKhz; - RADIOLIB_DEBUG_PRINT("Symbol length: "); - RADIOLIB_DEBUG_PRINT(symbolLength); - RADIOLIB_DEBUG_PRINTLN(" ms"); + RADIOLIB_DEBUG_PRINTLN("Symbol length: %d ms", symbolLength); if(symbolLength >= 16.0) { _ldro = RADIOLIB_SX126X_LORA_LOW_DATA_RATE_OPTIMIZE_ON; } else { @@ -1976,8 +1965,7 @@ int16_t SX126x::config(uint8_t modem) { // unless mode is forced to standby, device errors will be 0 standby(); uint16_t errors = getDeviceErrors(); - RADIOLIB_DEBUG_PRINT("Calibration failed, device errors: 0x"); - RADIOLIB_DEBUG_PRINTLN(errors, HEX); + RADIOLIB_DEBUG_PRINTLN("Calibration failed, device errors: 0x%X", errors); } #endif @@ -2010,18 +1998,15 @@ bool SX126x::findChip(const char* verStr) { // check version register if(strncmp(verStr, version, 6) == 0) { - RADIOLIB_DEBUG_PRINTLN(F("Found SX126x: RADIOLIB_SX126X_REG_VERSION_STRING:")); + RADIOLIB_DEBUG_PRINTLN("Found SX126x: RADIOLIB_SX126X_REG_VERSION_STRING:"); _mod->hexdump((uint8_t*)version, 16, RADIOLIB_SX126X_REG_VERSION_STRING); RADIOLIB_DEBUG_PRINTLN(); flagFound = true; } else { #if defined(RADIOLIB_DEBUG) - RADIOLIB_DEBUG_PRINT(F("SX126x not found! (")); - RADIOLIB_DEBUG_PRINT(i + 1); - RADIOLIB_DEBUG_PRINTLN(F(" of 10 tries) RADIOLIB_SX126X_REG_VERSION_STRING:")); + RADIOLIB_DEBUG_PRINTLN("SX126x not found! (%d of 10 tries) RADIOLIB_SX126X_REG_VERSION_STRING:", i + 1); _mod->hexdump((uint8_t*)version, 16, RADIOLIB_SX126X_REG_VERSION_STRING); - RADIOLIB_DEBUG_PRINT(F("Expected string: ")); - RADIOLIB_DEBUG_PRINTLN(verStr); + RADIOLIB_DEBUG_PRINTLN("Expected string: %s", verStr); #endif _mod->delay(10); i++; diff --git a/src/modules/SX127x/SX1272.cpp b/src/modules/SX127x/SX1272.cpp index 27a01722..64b75ba7 100644 --- a/src/modules/SX127x/SX1272.cpp +++ b/src/modules/SX127x/SX1272.cpp @@ -116,9 +116,7 @@ int16_t SX1272::setBandwidth(float bw) { // calculate symbol length and set low data rate optimization, if auto-configuration is enabled if(_ldroAuto) { float symbolLength = (float)(uint32_t(1) << SX127x::_sf) / (float)SX127x::_bw; - RADIOLIB_DEBUG_PRINT("Symbol length: "); - RADIOLIB_DEBUG_PRINT(symbolLength); - RADIOLIB_DEBUG_PRINTLN(" ms"); + RADIOLIB_DEBUG_PRINTLN("Symbol length: %f ms", symbolLength); if(symbolLength >= 16.0) { state = _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_MODEM_CONFIG_1, RADIOLIB_SX1272_LOW_DATA_RATE_OPT_ON, 0, 0); } else { @@ -172,9 +170,7 @@ int16_t SX1272::setSpreadingFactor(uint8_t sf) { // calculate symbol length and set low data rate optimization, if auto-configuration is enabled if(_ldroAuto) { float symbolLength = (float)(uint32_t(1) << SX127x::_sf) / (float)SX127x::_bw; - RADIOLIB_DEBUG_PRINT("Symbol length: "); - RADIOLIB_DEBUG_PRINT(symbolLength); - RADIOLIB_DEBUG_PRINTLN(" ms"); + RADIOLIB_DEBUG_PRINTLN("Symbol length: %f ms", symbolLength); if(symbolLength >= 16.0) { state = _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_MODEM_CONFIG_1, RADIOLIB_SX1272_LOW_DATA_RATE_OPT_ON, 0, 0); } else { diff --git a/src/modules/SX127x/SX1278.cpp b/src/modules/SX127x/SX1278.cpp index c8e5832a..aeb947f0 100644 --- a/src/modules/SX127x/SX1278.cpp +++ b/src/modules/SX127x/SX1278.cpp @@ -130,9 +130,7 @@ int16_t SX1278::setBandwidth(float bw) { // calculate symbol length and set low data rate optimization, if auto-configuration is enabled if(_ldroAuto) { float symbolLength = (float)(uint32_t(1) << SX127x::_sf) / (float)SX127x::_bw; - RADIOLIB_DEBUG_PRINT("Symbol length: "); - RADIOLIB_DEBUG_PRINT(symbolLength); - RADIOLIB_DEBUG_PRINTLN(" ms"); + RADIOLIB_DEBUG_PRINTLN("Symbol length: %f ms", symbolLength); if(symbolLength >= 16.0) { state = _mod->SPIsetRegValue(RADIOLIB_SX1278_REG_MODEM_CONFIG_3, RADIOLIB_SX1278_LOW_DATA_RATE_OPT_ON, 3, 3); } else { @@ -186,9 +184,7 @@ int16_t SX1278::setSpreadingFactor(uint8_t sf) { // calculate symbol length and set low data rate optimization, if auto-configuration is enabled if(_ldroAuto) { float symbolLength = (float)(uint32_t(1) << SX127x::_sf) / (float)SX127x::_bw; - RADIOLIB_DEBUG_PRINT("Symbol length: "); - RADIOLIB_DEBUG_PRINT(symbolLength); - RADIOLIB_DEBUG_PRINTLN(" ms"); + RADIOLIB_DEBUG_PRINT("Symbol length: %f ms", symbolLength); if(symbolLength >= 16.0) { state = _mod->SPIsetRegValue(RADIOLIB_SX1278_REG_MODEM_CONFIG_3, RADIOLIB_SX1278_LOW_DATA_RATE_OPT_ON, 3, 3); } else { diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index b7c4d8f5..e8742858 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -17,11 +17,11 @@ int16_t SX127x::begin(uint8_t chipVersion, uint8_t syncWord, uint16_t preambleLe // try to find the SX127x chip if(!SX127x::findChip(chipVersion)) { - RADIOLIB_DEBUG_PRINTLN(F("No SX127x found!")); + RADIOLIB_DEBUG_PRINTLN("No SX127x found!"); _mod->term(); return(RADIOLIB_ERR_CHIP_NOT_FOUND); } - RADIOLIB_DEBUG_PRINTLN(F("M\tSX127x")); + RADIOLIB_DEBUG_PRINTLN("M\tSX127x"); // set mode to standby int16_t state = standby(); @@ -64,11 +64,11 @@ int16_t SX127x::beginFSK(uint8_t chipVersion, float freqDev, float rxBw, uint16_ // try to find the SX127x chip if(!SX127x::findChip(chipVersion)) { - RADIOLIB_DEBUG_PRINTLN(F("No SX127x found!")); + RADIOLIB_DEBUG_PRINTLN("No SX127x found!"); _mod->term(); return(RADIOLIB_ERR_CHIP_NOT_FOUND); } - RADIOLIB_DEBUG_PRINTLN(F("M\tSX127x")); + RADIOLIB_DEBUG_PRINTLN("M\tSX127x"); // set mode to standby int16_t state = standby(); @@ -1434,17 +1434,7 @@ bool SX127x::findChip(uint8_t ver) { if(version == ver) { flagFound = true; } else { - #if defined(RADIOLIB_DEBUG) - RADIOLIB_DEBUG_PRINT(F("SX127x not found! (")); - RADIOLIB_DEBUG_PRINT(i + 1); - RADIOLIB_DEBUG_PRINT(F(" of 10 tries) RADIOLIB_SX127X_REG_VERSION == ")); - - char buffHex[12]; - sprintf(buffHex, "0x%04X", version); - RADIOLIB_DEBUG_PRINT(buffHex); - RADIOLIB_DEBUG_PRINT(F(", expected 0x00")); - RADIOLIB_DEBUG_PRINTLN(ver, HEX); - #endif + RADIOLIB_DEBUG_PRINTLN("SX127x not found! (%d of 10 tries) RADIOLIB_SX127X_REG_VERSION == 0x%04X, expected 0x00%X", i + 1, version, ver); _mod->delay(10); i++; } diff --git a/src/modules/SX128x/SX128x.cpp b/src/modules/SX128x/SX128x.cpp index 5a2619c8..8c6ec31a 100644 --- a/src/modules/SX128x/SX128x.cpp +++ b/src/modules/SX128x/SX128x.cpp @@ -20,7 +20,7 @@ int16_t SX128x::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t sync _mod->SPIstatusCommand = RADIOLIB_SX128X_CMD_GET_STATUS; _mod->SPIstreamType = true; _mod->SPIparseStatusCb = SPIparseStatus; - RADIOLIB_DEBUG_PRINTLN(F("M\tSX128x")); + RADIOLIB_DEBUG_PRINTLN("M\tSX128x"); // initialize LoRa modulation variables _bwKhz = bw; @@ -81,7 +81,7 @@ int16_t SX128x::beginGFSK(float freq, uint16_t br, float freqDev, int8_t power, _mod->SPIstatusCommand = RADIOLIB_SX128X_CMD_GET_STATUS; _mod->SPIstreamType = true; _mod->SPIparseStatusCb = SPIparseStatus; - RADIOLIB_DEBUG_PRINTLN(F("M\tSX128x")); + RADIOLIB_DEBUG_PRINTLN("M\tSX128x"); // initialize GFSK modulation variables _brKbps = br; @@ -150,7 +150,7 @@ int16_t SX128x::beginBLE(float freq, uint16_t br, float freqDev, int8_t power, u _mod->SPIstatusCommand = RADIOLIB_SX128X_CMD_GET_STATUS; _mod->SPIstreamType = true; _mod->SPIparseStatusCb = SPIparseStatus; - RADIOLIB_DEBUG_PRINTLN(F("M\tSX128x")); + RADIOLIB_DEBUG_PRINTLN("M\tSX128x"); // initialize BLE modulation variables _brKbps = br; @@ -205,7 +205,7 @@ int16_t SX128x::beginFLRC(float freq, uint16_t br, uint8_t cr, int8_t power, uin _mod->SPIstatusCommand = RADIOLIB_SX128X_CMD_GET_STATUS; _mod->SPIstreamType = true; _mod->SPIparseStatusCb = SPIparseStatus; - RADIOLIB_DEBUG_PRINTLN(F("M\tSX128x")); + RADIOLIB_DEBUG_PRINTLN("M\tSX128x"); // initialize FLRC modulation variables _brKbps = br; @@ -311,9 +311,7 @@ int16_t SX128x::transmit(uint8_t* data, size_t len, uint8_t addr) { // calculate timeout (500% of expected time-on-air) uint32_t timeout = getTimeOnAir(len) * 5; - RADIOLIB_DEBUG_PRINT(F("Timeout in ")); - RADIOLIB_DEBUG_PRINT(timeout); - RADIOLIB_DEBUG_PRINTLN(F(" us")); + RADIOLIB_DEBUG_PRINTLN("Timeout in %d us", timeout); // start transmission state = startTransmit(data, len, addr); @@ -346,9 +344,7 @@ int16_t SX128x::receive(uint8_t* data, size_t len) { // calculate timeout (1000% of expected time-on-air) uint32_t timeout = getTimeOnAir(len) * 10; - RADIOLIB_DEBUG_PRINT(F("Timeout in ")); - RADIOLIB_DEBUG_PRINT(timeout); - RADIOLIB_DEBUG_PRINTLN(F(" us")); + RADIOLIB_DEBUG_PRINTLN("Timeout in %d us", timeout); // start reception uint32_t timeoutValue = (uint32_t)((float)timeout / 15.625); diff --git a/src/modules/Si443x/Si4430.cpp b/src/modules/Si443x/Si4430.cpp index d6f40326..ecc8d8c6 100644 --- a/src/modules/Si443x/Si4430.cpp +++ b/src/modules/Si443x/Si4430.cpp @@ -9,7 +9,7 @@ int16_t Si4430::begin(float freq, float br, float freqDev, float rxBw, int8_t po // execute common part int16_t state = Si443x::begin(br, freqDev, rxBw, preambleLen); RADIOLIB_ASSERT(state); - RADIOLIB_DEBUG_PRINTLN(F("M\tSi4430")); + RADIOLIB_DEBUG_PRINTLN("M\tSi4430"); // configure publicly accessible settings state = setFrequency(freq); diff --git a/src/modules/Si443x/Si4431.cpp b/src/modules/Si443x/Si4431.cpp index 832ed432..98b07a8f 100644 --- a/src/modules/Si443x/Si4431.cpp +++ b/src/modules/Si443x/Si4431.cpp @@ -9,7 +9,7 @@ int16_t Si4431::begin(float freq, float br, float freqDev, float rxBw, int8_t po // execute common part int16_t state = Si443x::begin(br, freqDev, rxBw, preambleLen); RADIOLIB_ASSERT(state); - RADIOLIB_DEBUG_PRINTLN(F("M\tSi4431")); + RADIOLIB_DEBUG_PRINTLN("M\tSi4431"); // configure publicly accessible settings state = setFrequency(freq); diff --git a/src/modules/Si443x/Si4432.cpp b/src/modules/Si443x/Si4432.cpp index 06921add..76147df4 100644 --- a/src/modules/Si443x/Si4432.cpp +++ b/src/modules/Si443x/Si4432.cpp @@ -9,7 +9,7 @@ int16_t Si4432::begin(float freq, float br, float freqDev, float rxBw, int8_t po // execute common part int16_t state = Si443x::begin(br, freqDev, rxBw, preambleLen); RADIOLIB_ASSERT(state); - RADIOLIB_DEBUG_PRINTLN(F("M\tSi4432")); + RADIOLIB_DEBUG_PRINTLN("M\tSi4432"); // configure publicly accessible settings state = setFrequency(freq); diff --git a/src/modules/Si443x/Si443x.cpp b/src/modules/Si443x/Si443x.cpp index cabf6789..85719004 100644 --- a/src/modules/Si443x/Si443x.cpp +++ b/src/modules/Si443x/Si443x.cpp @@ -18,11 +18,11 @@ int16_t Si443x::begin(float br, float freqDev, float rxBw, uint8_t preambleLen) // try to find the Si443x chip if(!Si443x::findChip()) { - RADIOLIB_DEBUG_PRINTLN(F("No Si443x found!")); + RADIOLIB_DEBUG_PRINTLN("No Si443x found!"); _mod->term(); return(RADIOLIB_ERR_CHIP_NOT_FOUND); } else { - RADIOLIB_DEBUG_PRINTLN(F("M\tSi443x")); + RADIOLIB_DEBUG_PRINTLN("M\tSi443x"); } // reset the device @@ -683,17 +683,7 @@ bool Si443x::findChip() { if(version == RADIOLIB_SI443X_DEVICE_VERSION) { flagFound = true; } else { - #if defined(RADIOLIB_DEBUG) - RADIOLIB_DEBUG_PRINT(F("Si443x not found! (")); - RADIOLIB_DEBUG_PRINT(i + 1); - RADIOLIB_DEBUG_PRINT(F(" of 10 tries) RADIOLIB_SI443X_REG_DEVICE_VERSION == ")); - - char buffHex[5]; - sprintf(buffHex, "0x%02X", version); - RADIOLIB_DEBUG_PRINT(buffHex); - RADIOLIB_DEBUG_PRINT(F(", expected 0x00")); - RADIOLIB_DEBUG_PRINTLN(RADIOLIB_SI443X_DEVICE_VERSION, HEX); - #endif + RADIOLIB_DEBUG_PRINTLN("Si443x not found! (%d of 10 tries) RADIOLIB_SI443X_REG_DEVICE_VERSION == 0x%02X, expected 0x0%X", i + 1, version, RADIOLIB_SI443X_DEVICE_VERSION); _mod->delay(10); i++; } @@ -762,20 +752,8 @@ int16_t Si443x::updateClockRecovery() { uint16_t rxOsr_fixed = (uint16_t)rxOsr; // print that whole mess - RADIOLIB_DEBUG_PRINTLN(bypass, HEX); - RADIOLIB_DEBUG_PRINTLN(decRate, HEX); - RADIOLIB_DEBUG_PRINTLN(manch, HEX); - RADIOLIB_DEBUG_PRINT(rxOsr, 3); - RADIOLIB_DEBUG_PRINT('\t'); - RADIOLIB_DEBUG_PRINT(rxOsr_fixed); - RADIOLIB_DEBUG_PRINT('\t'); - RADIOLIB_DEBUG_PRINTLN(rxOsr_fixed, HEX); - RADIOLIB_DEBUG_PRINT(ncoOff); - RADIOLIB_DEBUG_PRINT('\t'); - RADIOLIB_DEBUG_PRINTLN(ncoOff, HEX); - RADIOLIB_DEBUG_PRINT(crGain); - RADIOLIB_DEBUG_PRINT('\t'); - RADIOLIB_DEBUG_PRINTLN(crGain, HEX); + RADIOLIB_DEBUG_PRINTLN("%X\n%X\n%X", bypass, decRate, manch); + RADIOLIB_DEBUG_PRINTLN("%f\t%d\t%X\n%d\t%X\n%d\t%X", rxOsr, rxOsr_fixed, rxOsr_fixed, ncoOff, ncoOff, crGain, crGain); // update oversampling ratio int16_t state = _mod->SPIsetRegValue(RADIOLIB_SI443X_REG_CLOCK_REC_OFFSET_2, (uint8_t)((rxOsr_fixed & 0x0700) >> 3), 7, 5); diff --git a/src/modules/nRF24/nRF24.cpp b/src/modules/nRF24/nRF24.cpp index e158a043..d8194d21 100644 --- a/src/modules/nRF24/nRF24.cpp +++ b/src/modules/nRF24/nRF24.cpp @@ -26,11 +26,11 @@ int16_t nRF24::begin(int16_t freq, int16_t dataRate, int8_t power, uint8_t addrW // check SPI connection int16_t val = _mod->SPIgetRegValue(RADIOLIB_NRF24_REG_SETUP_AW); if(!((val >= 0) && (val <= 3))) { - RADIOLIB_DEBUG_PRINTLN(F("No nRF24 found!")); + RADIOLIB_DEBUG_PRINTLN("No nRF24 found!"); _mod->term(); return(RADIOLIB_ERR_CHIP_NOT_FOUND); } - RADIOLIB_DEBUG_PRINTLN(F("M\tnRF24")); + RADIOLIB_DEBUG_PRINTLN("M\tnRF24"); // configure settings inaccessible by public API int16_t state = config(); diff --git a/src/protocols/Morse/Morse.cpp b/src/protocols/Morse/Morse.cpp index 3fbe3dd4..7810032f 100644 --- a/src/protocols/Morse/Morse.cpp +++ b/src/protocols/Morse/Morse.cpp @@ -91,17 +91,15 @@ int MorseClient::read(byte* symbol, byte* len, float low, float high) { uint32_t signalLen = mod->millis() - signalStart; if((signalLen >= low*(float)_dotLength) && (signalLen <= high*(float)_dotLength)) { - RADIOLIB_DEBUG_PRINT('.'); + RADIOLIB_DEBUG_PRINT("."); (*symbol) |= (RADIOLIB_MORSE_DOT << (*len)); (*len)++; } else if((signalLen >= low*(float)_dashLength) && (signalLen <= high*(float)_dashLength)) { - RADIOLIB_DEBUG_PRINT('-'); + RADIOLIB_DEBUG_PRINT("-"); (*symbol) |= (RADIOLIB_MORSE_DASH << (*len)); (*len)++; } else { - RADIOLIB_DEBUG_PRINT(""); + RADIOLIB_DEBUG_PRINTLN("", signalLen); } } @@ -135,7 +133,7 @@ size_t MorseClient::write(uint8_t b) { // inter-word pause (space) if(b == ' ') { - RADIOLIB_DEBUG_PRINTLN(F("space")); + RADIOLIB_DEBUG_PRINTLN("space"); standby(); mod->waitForMicroseconds(mod->micros(), _wordSpace*1000); return(1); @@ -154,11 +152,11 @@ size_t MorseClient::write(uint8_t b) { // send dot or dash if (code & RADIOLIB_MORSE_DASH) { - RADIOLIB_DEBUG_PRINT('-'); + RADIOLIB_DEBUG_PRINT("-"); transmitDirect(_base, _baseHz); mod->waitForMicroseconds(mod->micros(), _dashLength*1000); } else { - RADIOLIB_DEBUG_PRINT('.'); + RADIOLIB_DEBUG_PRINT("."); transmitDirect(_base, _baseHz); mod->waitForMicroseconds(mod->micros(), _dotLength*1000); } diff --git a/src/protocols/Pager/Pager.cpp b/src/protocols/Pager/Pager.cpp index f6aae335..5a510308 100644 --- a/src/protocols/Pager/Pager.cpp +++ b/src/protocols/Pager/Pager.cpp @@ -496,9 +496,7 @@ uint32_t PagerClient::read() { codeWord = ~codeWord; } - RADIOLIB_VERBOSE_PRINT("R\t"); - RADIOLIB_VERBOSE_PRINTLN(codeWord, HEX); - + RADIOLIB_VERBOSE_PRINTLN("R\t%X", codeWord); // TODO BCH error correction here return(codeWord); } diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.cpp b/src/protocols/PhysicalLayer/PhysicalLayer.cpp index 46093ba9..48eeda61 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.cpp +++ b/src/protocols/PhysicalLayer/PhysicalLayer.cpp @@ -274,7 +274,7 @@ int32_t PhysicalLayer::random(int32_t max) { if(randNum < 0) { randNum *= -1; } - RADIOLIB_DEBUG_PRINTLN(randNum); + RADIOLIB_DEBUG_PRINTLN("%d", randNum); return(randNum % max); } @@ -346,8 +346,7 @@ void PhysicalLayer::updateDirectBuffer(uint8_t bit) { _syncBuffer <<= 1; _syncBuffer |= bit; - RADIOLIB_VERBOSE_PRINT("S\t"); - RADIOLIB_VERBOSE_PRINTLN(_syncBuffer, HEX); + RADIOLIB_VERBOSE_PRINTLN("S\t%X", _syncBuffer); if((_syncBuffer & _directSyncWordMask) == _directSyncWord) { _gotSync = true; @@ -368,8 +367,7 @@ void PhysicalLayer::updateDirectBuffer(uint8_t bit) { // check complete byte if(_bufferBitPos == 8) { _buffer[_bufferWritePos] = Module::flipBits(_buffer[_bufferWritePos]); - RADIOLIB_VERBOSE_PRINT("R\t"); - RADIOLIB_VERBOSE_PRINTLN(_buffer[_bufferWritePos], HEX); + RADIOLIB_VERBOSE_PRINTLN("R\t%X", _buffer[_bufferWritePos]); _bufferWritePos++; _bufferBitPos = 0;