Revert NetworkDebugPrinter changes.
This commit is contained in:
parent
77f04d913a
commit
6403d18d15
@ -3,26 +3,7 @@
|
|||||||
#ifdef WLED_DEBUG_HOST
|
#ifdef WLED_DEBUG_HOST
|
||||||
|
|
||||||
size_t NetworkDebugPrinter::write(uint8_t c) {
|
size_t NetworkDebugPrinter::write(uint8_t c) {
|
||||||
begin();
|
if (!WLED_CONNECTED) return 0;
|
||||||
if (!udpConnected) return 0;
|
|
||||||
return debugUdp.write(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t NetworkDebugPrinter::write(const uint8_t *buf, size_t size) {
|
|
||||||
if (buf == nullptr) return 0;
|
|
||||||
begin();
|
|
||||||
if (!udpConnected) return 0;
|
|
||||||
return debugUdp.write(buf, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NetworkDebugPrinter::begin() {
|
|
||||||
if (udpConnected) return;
|
|
||||||
if (!WLED_CONNECTED) {
|
|
||||||
debugUdp.stop();
|
|
||||||
debugPrintHostIP = INADDR_NONE;
|
|
||||||
udpConnected = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!debugPrintHostIP && !debugPrintHostIP.fromString(netDebugPrintHost)) {
|
if (!debugPrintHostIP && !debugPrintHostIP.fromString(netDebugPrintHost)) {
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
@ -36,13 +17,31 @@ void NetworkDebugPrinter::begin() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
udpConnected = debugUdp.beginPacket(debugPrintHostIP, netDebugPrintPort);
|
debugUdp.beginPacket(debugPrintHostIP, netDebugPrintPort);
|
||||||
|
debugUdp.write(c);
|
||||||
|
debugUdp.endPacket();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkDebugPrinter::flush() {
|
size_t NetworkDebugPrinter::write(const uint8_t *buf, size_t size) {
|
||||||
if (udpConnected) {
|
if (!WLED_CONNECTED || buf == nullptr) return 0;
|
||||||
if (!debugUdp.endPacket()) udpConnected = false; // we were not able to send packet
|
|
||||||
|
if (!debugPrintHostIP && !debugPrintHostIP.fromString(netDebugPrintHost)) {
|
||||||
|
#ifdef ESP8266
|
||||||
|
WiFi.hostByName(netDebugPrintHost, debugPrintHostIP, 750);
|
||||||
|
#else
|
||||||
|
#ifdef WLED_USE_ETHERNET
|
||||||
|
ETH.hostByName(netDebugPrintHost, debugPrintHostIP);
|
||||||
|
#else
|
||||||
|
WiFi.hostByName(netDebugPrintHost, debugPrintHostIP);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debugUdp.beginPacket(debugPrintHostIP, netDebugPrintPort);
|
||||||
|
size = debugUdp.write(buf, size);
|
||||||
|
debugUdp.endPacket();
|
||||||
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkDebugPrinter NetDebug;
|
NetworkDebugPrinter NetDebug;
|
||||||
|
@ -7,14 +7,10 @@
|
|||||||
class NetworkDebugPrinter : public Print {
|
class NetworkDebugPrinter : public Print {
|
||||||
private:
|
private:
|
||||||
WiFiUDP debugUdp; // needs to be here otherwise UDP messages get truncated upon destruction
|
WiFiUDP debugUdp; // needs to be here otherwise UDP messages get truncated upon destruction
|
||||||
IPAddress debugPrintHostIP = INADDR_NONE;
|
IPAddress debugPrintHostIP;
|
||||||
bool udpConnected = false;
|
|
||||||
public:
|
public:
|
||||||
virtual ~NetworkDebugPrinter() { flush(); }
|
|
||||||
virtual size_t write(uint8_t c);
|
virtual size_t write(uint8_t c);
|
||||||
virtual size_t write(const uint8_t *buf, size_t s);
|
virtual size_t write(const uint8_t *buf, size_t s);
|
||||||
void begin();
|
|
||||||
void flush();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern NetworkDebugPrinter NetDebug;
|
extern NetworkDebugPrinter NetDebug;
|
||||||
|
@ -218,7 +218,6 @@ void WLED::loop()
|
|||||||
debugTime = millis();
|
debugTime = millis();
|
||||||
}
|
}
|
||||||
loops++;
|
loops++;
|
||||||
DEBUG_FLUSH();
|
|
||||||
#endif // WLED_DEBUG
|
#endif // WLED_DEBUG
|
||||||
toki.resetTick();
|
toki.resetTick();
|
||||||
|
|
||||||
@ -447,8 +446,6 @@ void WLED::setup()
|
|||||||
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_DISABLE_BROWNOUT_DET)
|
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_DISABLE_BROWNOUT_DET)
|
||||||
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 1); //enable brownout detector
|
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 1); //enable brownout detector
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUG_FLUSH();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WLED::beginStrip()
|
void WLED::beginStrip()
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2211110
|
#define VERSION 2211111
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
@ -695,24 +695,20 @@ WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0);
|
|||||||
#define DEBUG_PRINT(x) DEBUGOUT.print(x)
|
#define DEBUG_PRINT(x) DEBUGOUT.print(x)
|
||||||
#define DEBUG_PRINTLN(x) DEBUGOUT.println(x)
|
#define DEBUG_PRINTLN(x) DEBUGOUT.println(x)
|
||||||
#define DEBUG_PRINTF(x...) DEBUGOUT.printf(x)
|
#define DEBUG_PRINTF(x...) DEBUGOUT.printf(x)
|
||||||
#define DEBUG_FLUSH() DEBUGOUT.flush()
|
|
||||||
#else
|
#else
|
||||||
#define DEBUG_PRINT(x)
|
#define DEBUG_PRINT(x)
|
||||||
#define DEBUG_PRINTLN(x)
|
#define DEBUG_PRINTLN(x)
|
||||||
#define DEBUG_PRINTF(x...)
|
#define DEBUG_PRINTF(x...)
|
||||||
#define DEBUG_FLUSH()
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WLED_DEBUG_FS
|
#ifdef WLED_DEBUG_FS
|
||||||
#define DEBUGFS_PRINT(x) DEBUGOUT.print(x)
|
#define DEBUGFS_PRINT(x) DEBUGOUT.print(x)
|
||||||
#define DEBUGFS_PRINTLN(x) DEBUGOUT.println(x)
|
#define DEBUGFS_PRINTLN(x) DEBUGOUT.println(x)
|
||||||
#define DEBUGFS_PRINTF(x...) DEBUGOUT.printf(x)
|
#define DEBUGFS_PRINTF(x...) DEBUGOUT.printf(x)
|
||||||
#define DEBUGFS_FLUSH() DEBUGOUT.flush()
|
|
||||||
#else
|
#else
|
||||||
#define DEBUGFS_PRINT(x)
|
#define DEBUGFS_PRINT(x)
|
||||||
#define DEBUGFS_PRINTLN(x)
|
#define DEBUGFS_PRINTLN(x)
|
||||||
#define DEBUGFS_PRINTF(x...)
|
#define DEBUGFS_PRINTF(x...)
|
||||||
#define DEBUGFS_FLUSH()
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// debug macro variable definitions
|
// debug macro variable definitions
|
||||||
|
Loading…
Reference in New Issue
Block a user