diff --git a/code/espurna/debug.ino b/code/espurna/debug.ino index 77e09d8a..d8937f70 100644 --- a/code/espurna/debug.ino +++ b/code/espurna/debug.ino @@ -8,8 +8,6 @@ Copyright (C) 2016-2018 by Xose PĂ©rez #if DEBUG_SUPPORT -constexpr const uint8_t TIMESTAMP_LENGTH = 10; - #if DEBUG_UDP_SUPPORT #include WiFiUDP _udp_debug; @@ -24,14 +22,17 @@ void _debugSend(char * message) { bool pause = false; #if DEBUG_ADD_TIMESTAMP + const char TIMESTAMP_FMT[] = "[%06lu] "; + const uint8_t TIMESTAMP_SIZE = 10; + static bool add_timestamp = true; size_t offset = 0; - char buffer[TIMESTAMP_LENGTH + msg_len]; + char buffer[TIMESTAMP_SIZE + msg_len]; if (add_timestamp) { - snprintf_P(buffer, TIMESTAMP_LENGTH, PSTR("[%06lu] "), millis() % 1000000); - offset = TIMESTAMP_LENGTH - 1; + snprintf(buffer, TIMESTAMP_SIZE, TIMESTAMP_FMT, millis() % 1000000); + offset = TIMESTAMP_SIZE - 1; } memcpy(buffer + offset, message, msg_len);