diff --git a/src/BuildOpt.h b/src/BuildOpt.h index 297a91e4..e9a40516 100644 --- a/src/BuildOpt.h +++ b/src/BuildOpt.h @@ -118,6 +118,10 @@ //#define RADIOLIB_CLOCK_DRIFT_MS (0) #endif +#if !defined(RADIOLIB_LINE_FEED) + #define RADIOLIB_LINE_FEED "\r\n" +#endif + #if ARDUINO >= 100 // Arduino build #include "Arduino.h" @@ -471,9 +475,9 @@ #if RADIOLIB_DEBUG #if defined(RADIOLIB_BUILD_ARDUINO) #define RADIOLIB_DEBUG_PRINT(...) rlb_printf(__VA_ARGS__) - #define RADIOLIB_DEBUG_PRINTLN(M, ...) rlb_printf(M "\n", ##__VA_ARGS__) + #define RADIOLIB_DEBUG_PRINTLN(M, ...) rlb_printf(M "" RADIOLIB_LINE_FEED, ##__VA_ARGS__) #define RADIOLIB_DEBUG_PRINT_LVL(LEVEL, M, ...) rlb_printf(LEVEL "" M, ##__VA_ARGS__) - #define RADIOLIB_DEBUG_PRINTLN_LVL(LEVEL, M, ...) rlb_printf(LEVEL "" M "\n", ##__VA_ARGS__) + #define RADIOLIB_DEBUG_PRINTLN_LVL(LEVEL, M, ...) rlb_printf(LEVEL "" M "" RADIOLIB_LINE_FEED, ##__VA_ARGS__) // some platforms do not support printf("%f"), so it has to be done this way #define RADIOLIB_DEBUG_PRINT_FLOAT(LEVEL, VAL, DECIMALS) RADIOLIB_DEBUG_PRINT(LEVEL); RADIOLIB_DEBUG_PORT.print(VAL, DECIMALS) @@ -483,8 +487,8 @@ #define RADIOLIB_DEBUG_PRINT_LVL(LEVEL, M, ...) fprintf(RADIOLIB_DEBUG_PORT, LEVEL "" M, ##__VA_ARGS__) #endif #if !defined(RADIOLIB_DEBUG_PRINTLN) - #define RADIOLIB_DEBUG_PRINTLN(M, ...) fprintf(RADIOLIB_DEBUG_PORT, M "\n", ##__VA_ARGS__) - #define RADIOLIB_DEBUG_PRINTLN_LVL(LEVEL, M, ...) fprintf(RADIOLIB_DEBUG_PORT, LEVEL "" M "\n", ##__VA_ARGS__) + #define RADIOLIB_DEBUG_PRINTLN(M, ...) fprintf(RADIOLIB_DEBUG_PORT, M "" RADIOLIB_LINE_FEED, ##__VA_ARGS__) + #define RADIOLIB_DEBUG_PRINTLN_LVL(LEVEL, M, ...) fprintf(RADIOLIB_DEBUG_PORT, LEVEL "" M "" RADIOLIB_LINE_FEED, ##__VA_ARGS__) #endif #define RADIOLIB_DEBUG_PRINT_FLOAT(LEVEL, VAL, DECIMALS) RADIOLIB_DEBUG_PRINT(LEVEL "%.3f", VAL) #endif @@ -545,12 +549,12 @@ #define RADIOLIB_VALUE_TO_STRING(x) #x #define RADIOLIB_VALUE(x) RADIOLIB_VALUE_TO_STRING(x) -#define RADIOLIB_INFO "\nRadioLib Info\nVersion: \"" \ +#define RADIOLIB_INFO "" RADIOLIB_LINE_FEED "RadioLib Info" RADIOLIB_LINE_FEED "Version: \"" \ RADIOLIB_VALUE(RADIOLIB_VERSION_MAJOR) "." \ RADIOLIB_VALUE(RADIOLIB_VERSION_MINOR) "." \ RADIOLIB_VALUE(RADIOLIB_VERSION_PATCH) "." \ - RADIOLIB_VALUE(RADIOLIB_VERSION_EXTRA) "\"\n" \ - "Platform: " RADIOLIB_VALUE(RADIOLIB_PLATFORM) "\n" \ + RADIOLIB_VALUE(RADIOLIB_VERSION_EXTRA) "\"" RADIOLIB_LINE_FEED \ + "Platform: " RADIOLIB_VALUE(RADIOLIB_PLATFORM) "" RADIOLIB_LINE_FEED \ "Compiled: " RADIOLIB_VALUE(__DATE__) " " RADIOLIB_VALUE(__TIME__) /*! diff --git a/src/modules/Si443x/Si443x.cpp b/src/modules/Si443x/Si443x.cpp index b66a9d22..cb09bfad 100644 --- a/src/modules/Si443x/Si443x.cpp +++ b/src/modules/Si443x/Si443x.cpp @@ -765,9 +765,9 @@ int16_t Si443x::updateClockRecovery() { uint16_t rxOsr_fixed = (uint16_t)rxOsr; // print that whole mess - RADIOLIB_DEBUG_BASIC_PRINTLN("%X\n%X\n%X", bypass, decRate, manch); + RADIOLIB_DEBUG_BASIC_PRINTLN("%X %X %X", bypass, decRate, manch); RADIOLIB_DEBUG_BASIC_PRINT_FLOAT((double)rxOsr, 2); - RADIOLIB_DEBUG_BASIC_PRINTLN("\t%d\t%X\n%lu\t%lX\n%d\t%X", rxOsr_fixed, rxOsr_fixed, (long unsigned int)ncoOff, (long unsigned int)ncoOff, crGain, crGain); + RADIOLIB_DEBUG_BASIC_PRINTLN("\t%d\t%X" RADIOLIB_LINE_FEED "%lu\t%lX" RADIOLIB_LINE_FEED "%d\t%X", rxOsr_fixed, rxOsr_fixed, (long unsigned int)ncoOff, (long unsigned int)ncoOff, crGain, crGain); // update oversampling ratio int16_t state = this->mod->SPIsetRegValue(RADIOLIB_SI443X_REG_CLOCK_REC_OFFSET_2, (uint8_t)((rxOsr_fixed & 0x0700) >> 3), 7, 5); diff --git a/src/protocols/Morse/Morse.cpp b/src/protocols/Morse/Morse.cpp index c261773b..fbacc824 100644 --- a/src/protocols/Morse/Morse.cpp +++ b/src/protocols/Morse/Morse.cpp @@ -86,7 +86,7 @@ int MorseClient::read(uint8_t* symbol, uint8_t* len, float low, float high) { if((pauseLen >= low*(float)letterSpace) && (pauseLen <= high*(float)letterSpace)) { return(RADIOLIB_MORSE_CHAR_COMPLETE); } else if(pauseLen > wordSpace) { - RADIOLIB_DEBUG_PROTOCOL_PRINTLN("\n"); + RADIOLIB_DEBUG_PROTOCOL_PRINTLN(RADIOLIB_LINE_FEED ""); return(RADIOLIB_MORSE_WORD_COMPLETE); } @@ -164,7 +164,7 @@ size_t MorseClient::write(uint8_t b) { // letter space standby(); mod->waitForMicroseconds(mod->hal->micros(), letterSpace*1000 - dotLength*1000); - RADIOLIB_DEBUG_PROTOCOL_PRINT_NOTAG("\n"); + RADIOLIB_DEBUG_PROTOCOL_PRINT_NOTAG(RADIOLIB_LINE_FEED); return(1); }