mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-06-25 15:01:36 +02:00
Compare commits
1 Commits
2.6.1
...
printf_deb
Author | SHA1 | Date | |
---|---|---|---|
83a87f7877 |
@ -50,7 +50,10 @@
|
||||
DEBUG_ESP_PORT.flush(); \
|
||||
}
|
||||
#else
|
||||
// #define DEBUG_WEBSOCKETS(...) os_printf( __VA_ARGS__ )
|
||||
#ifdef DEBUG_PORT
|
||||
#define DEBUG_WEBSOCKETS(...) websocket_debug_printf(__VA_ARGS__)
|
||||
void websocket_debug_printf(const char * format, ...);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
32
src/debug.cpp
Normal file
32
src/debug.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
#include "WebSockets.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef DEBUG_PORT
|
||||
|
||||
void websocket_debug_printf(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(std::nothrow) char[len + 1];
|
||||
if(!buffer) {
|
||||
return 0;
|
||||
}
|
||||
va_start(arg, format);
|
||||
vsnprintf(buffer, len + 1, format, arg);
|
||||
va_end(arg);
|
||||
}
|
||||
len = DEBUG_PORT.write((const uint8_t *)buffer, len);
|
||||
if(buffer != temp) {
|
||||
delete[] buffer;
|
||||
}
|
||||
DEBUG_PORT.flush();
|
||||
return len;
|
||||
}
|
||||
|
||||
#endif
|
@ -73,7 +73,7 @@ def get_library_json_version():
|
||||
|
||||
def get_header_versions():
|
||||
data = {}
|
||||
define = re.compile('^#define WEBSOCKETS_VERSION_?(.*) "?([0-9\.]*)"?$')
|
||||
define = re.compile('^#define WEBSOCKETS_VERSION_?(.*) "?([0-9\\.]*)"?$')
|
||||
with open(f'{base_dir}/src/WebSocketsVersion.h', 'r') as f:
|
||||
for line in f:
|
||||
m = define.match(line)
|
||||
|
Reference in New Issue
Block a user