Verze 1.1.0 - TRACEPLUS() je nyni obecne definovane a pouziva constexpr

This commit is contained in:
Pavel Brychta 2024-07-10 15:49:11 +02:00
parent b2d4fcdc4c
commit 8f6521f761
4 changed files with 14 additions and 14 deletions

View File

@ -1,16 +1,14 @@
#include <trace.h>
#define TRACE(severity, fmt, ...) trace_print(severity, (PGM_P)PSTR(fmt), ## __VA_ARGS__)
#define TRACE_INIT trace_init()
#define TRACE_ADDWEB(srv) trace_addweb(srv)
#define TRACE_POLL trace_poll()
void setup(void)
{
Serial.begin(115200);
TRACE(TRACE_INFO, F("Setup..."));
}
void loop(void)
{
TRACE(TRACE_INFO, F("loop..."));
delay(1000);
}

View File

@ -12,7 +12,7 @@
"type": "git",
"url": "https://git.xpablo.cz/pablo2048/Trace.git"
},
"version": "1.0.0",
"version": "1.1.0",
"license": "MIT",
"frameworks": "arduino",
"platforms": ["espressif8266","espressif32"],

View File

@ -1,5 +1,5 @@
name=Trace
version=1.0.0
version=1.1.0
author=Pavel Brychta
maintainer=Pavel Brychta
sentence=Trace application internals & messages via web server or other output device

View File

@ -37,11 +37,7 @@
#if defined(TRACE_USE_ASYNC_WEBSOCKET)
#include "asyncWebsocket/traceAsyncWebsocket.hpp"
#define TRACEPLUS(when, severity, ...) \
do { \
if (when > 0) \
TRACE(severity, __VA_ARGS__) \
} while (0)
#define TRACE(severity, text, ...) \
do { \
constexpr bool trace_limit = (severity <= TRACE_LIMIT); \
@ -55,7 +51,6 @@
#define TRACE_FORCEUPDATE(a) trace_forceupdate()
#else
#define TRACEPLUS(...) ((void) 0)
#if defined(ESP32)
#include <Arduino.h>
#define TRACE(severity, format, ...) \
@ -142,3 +137,10 @@
#define TRACE_ADDWEB(a) ((void) 0)
#define TRACE_FORCEUPDATE(a) ((void) 0)
#endif
#define TRACEPLUS(when, severity, ...) \
do { \
constexpr bool handle = (when != 0); \
if (handle) \
TRACE(severity, __VA_ARGS__); \
} while (0)