Log using printf with a String stored in PROGMEM. Always.

This commit is contained in:
Fabian Schlenz 2019-06-18 18:13:37 +02:00
parent 5af7c6337d
commit 5a02050680

View File

@ -72,21 +72,39 @@
#define EFFECT_GOL_START_PERCENTAGE 90
#define EFFECT_GOL_BLEND_SPEED 10
#define EFFECT_GOL_RESTART_AFTER_STEPS 100
// Stop editing here
#ifdef DEBUG
#ifdef MQTT_ENABLE
#include "my_mqtt.h"
#define LOG(x) mqtt_log(x); Serial.print(x);
#define LOGln(x) mqtt_log_ln(x); Serial.println(x);
#define LOG(msg, ...) do { \
char buffer[128]; \
snprintf_P(buffer, 128, PSTR(msg), ##__VA_ARGS__);\
mqtt_log(buffer);\
Serial.print(buffer);\
} while (0);
#define LOGln(msg, ...) do {\
char buffer[128]; \
snprintf_P(buffer, 128, PSTR(msg), ##__VA_ARGS__);\
mqtt_log_ln(buffer);\
Serial.println(buffer);\
} while (0);
#else
#define LOG(x) Serial.print(x);
#define LOGln(x) Serial.println(x);
#define LOG(msg, ...) do { \
char buffer[128]; \
snprintf_P(buffer, 128, PSTR(msg), ##__VA_ARGS__);\
Serial.print(buffer);\
} while (0);
#define LOGln(msg, ...) do { \
char buffer[128]; \
snprintf_P(buffer, 128, PSTR(msg), ##__VA_ARGS__);\
Serial.println(buffer);\
} while (0);
#endif
#else
#define LOG(x) do {} while(0);
#define LOGln(x) do {} while(0);
#define LOG(msg, ...) do {} while(0);
#define LOGln(msg, ...) do {} while(0);
#endif
#if !defined( ESP8266 ) && !defined( ESP32 )