diff --git a/include/config.sample.h b/include/config.sample.h index 0bf0f96..4ef2c94 100644 --- a/include/config.sample.h +++ b/include/config.sample.h @@ -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 )