diff --git a/wled00/json.cpp b/wled00/json.cpp index cef6480b..c85340a4 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -917,6 +917,7 @@ void serializeInfo(JsonObject root) #ifdef WLED_DEBUG os = 0x80; #endif + //WLEDMM: WLED_DEBUG_HOST also if not WLED_DEBUG #ifdef WLED_DEBUG_HOST os |= 0x0100; if (!netDebugEnabled) os &= ~0x0080; diff --git a/wled00/pin_manager.cpp b/wled00/pin_manager.cpp index ead4134c..3bc423f0 100644 --- a/wled00/pin_manager.cpp +++ b/wled00/pin_manager.cpp @@ -450,7 +450,7 @@ bool PinManagerClass::allocatePin(byte gpio, bool output, PinOwner tag) DEBUG_PRINT(F("PIN ALLOC: FAIL for owner ")); DebugPrintOwnerTag(tag); DEBUG_PRINT(F(": GPIO ")); DEBUG_PRINT(gpio); - if (output) DEBUG_PRINTLN(F(" cannot be used for i/o on this MCU.")); + if (output) {DEBUG_PRINTLN(F(" cannot be used for i/o on this MCU."));} else DEBUG_PRINTLN(F(" cannot be used as input on this MCU.")); } else { DEBUG_PRINT(F("PIN ALLOC: FAIL: GPIO ")); DEBUG_PRINT(gpio); diff --git a/wled00/wled.h b/wled00/wled.h index 5db192b4..2b6c2eaa 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -723,6 +723,7 @@ WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0); // enable additional debug output //WLEDMM: switch between netdebug and serial +// cannot do this on -S2, due to buggy USBCDC serial driver: canUseSerial #if defined(WLED_DEBUG_HOST) #include "net_debug.h" // On the host side, use netcat to receive the log statements: nc -l 7868 -u @@ -730,15 +731,15 @@ WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0); WLED_GLOBAL bool netDebugEnabled _INIT(false); WLED_GLOBAL int netDebugPrintPort _INIT(0); WLED_GLOBAL IPAddress netDebugPrintIP _INIT_N(((0, 0, 0, 0))); // IP address of the bridge - #define DEBUGOUT(x) netDebugEnabled?NetDebug.print(x):Serial.print(x) - #define DEBUGOUTLN(x) netDebugEnabled?NetDebug.println(x):Serial.println(x) - #define DEBUGOUTF(x...) netDebugEnabled?NetDebug.printf(x):Serial.printf(x) - #define DEBUGOUTFlush() netDebugEnabled?NetDebug.flush():Serial.flush() + #define DEBUGOUT(x) (netDebugEnabled || !canUseSerial())?NetDebug.print(x):Serial.print(x) + #define DEBUGOUTLN(x) (netDebugEnabled || !canUseSerial())?NetDebug.println(x):Serial.println(x) + #define DEBUGOUTF(x...) (netDebugEnabled || !canUseSerial())?NetDebug.printf(x):Serial.printf(x) + #define DEBUGOUTFlush() (netDebugEnabled || !canUseSerial())?NetDebug.flush():Serial.flush() #else - #define DEBUGOUT(x) Serial.print(x) - #define DEBUGOUTLN(x) Serial.println(x) - #define DEBUGOUTF(x...) Serial.printf(x) - #define DEBUGOUTFlush() Serial.flush() + #define DEBUGOUT(x) {if (canUseSerial()) Serial.print(x);} + #define DEBUGOUTLN(x) {if (canUseSerial()) Serial.println(x);} + #define DEBUGOUTF(x...) {if (canUseSerial()) Serial.printf(x);} + #define DEBUGOUTFlush() {if (canUseSerial()) Serial.flush();} #endif #ifdef WLED_DEBUG @@ -754,25 +755,10 @@ WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0); #define DEBUG_PRINTF(x...) #endif -// WLEDMM: macros to print "user messages" to Serial -// cannot do this on -S2, due to buggy USBCDC serial driver -#if defined(WLED_DEBUG) || defined(WLED_DEBUG_HOST) - // use DEBUG_PRINT - #define USER_PRINT(x) DEBUG_PRINT(x) - #define USER_PRINTLN(x) DEBUG_PRINTLN(x) - #define USER_PRINTF(x...) DEBUG_PRINTF(x) - #ifdef WLED_DEBUG_HOST - #define USER_FLUSH() {} - #else - #define USER_FLUSH() {DEBUGOUTFlush();} - #endif -#else - // if serial is availeable, we use Serial.print directly - #define USER_PRINT(x) { if (canUseSerial()) DEBUGOUT(x); } - #define USER_PRINTLN(x) { if (canUseSerial()) DEBUGOUTLN(x); } - #define USER_PRINTF(x...) { if (canUseSerial()) DEBUGOUTF(x); } - #define USER_FLUSH() {DEBUGOUTFlush();} -#endif +#define USER_PRINT(x) DEBUGOUT(x) +#define USER_PRINTLN(x) DEBUGOUTLN(x) +#define USER_PRINTF(x...) DEBUGOUTF(x) +#define USER_FLUSH() DEBUGOUTFlush() // WLEDMM end #ifdef WLED_DEBUG_FS