diff --git a/core/MyOTALogging.cpp b/core/MyOTALogging.cpp index 179934d..693290f 100644 --- a/core/MyOTALogging.cpp +++ b/core/MyOTALogging.cpp @@ -36,11 +36,7 @@ void OTALog(uint8_t logNode, bool enableAck, const char *fmt, ... ) // create message va_start (args, fmt ); -#ifdef vsnprintf_P int n = vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args); -#else - int n = vsnprintf(fmtBuffer, sizeof(fmtBuffer), fmt, args); -#endif va_end (args); // Check number of chars @@ -92,14 +88,9 @@ void OTALogPrintPrefix() { char prefix[37]; // prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE) -#ifdef snprintf_P snprintf_P(prefix, sizeof(prefix), PSTR("%" PRId8 ";%" PRId8 ";%" PRId8 ";0;%" PRId8 ";%" PRIu32 " "), OTALogBufferNode, OTALogBufferSensor, C_INTERNAL, I_LOG_MESSAGE, hwMillis()); -#else - snprintf(prefix, sizeof(prefix), PSTR("%" PRId8 ";%" PRId8 ";%" PRId8 ";0;%" PRId8 ";%" PRIu32 " "), - OTALogBufferNode, OTALogBufferSensor, C_INTERNAL, I_LOG_MESSAGE, hwMillis()); -#endif MY_SERIALDEVICE.print(prefix); } diff --git a/examples/LogOTANode/LogOTANode.ino b/examples/LogOTANode/LogOTANode.ino index 891cd54..aaf1384 100644 --- a/examples/LogOTANode/LogOTANode.ino +++ b/examples/LogOTANode/LogOTANode.ino @@ -6,7 +6,7 @@ * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad - * Copyright (C) 2013-2015 Sensnology AB + * Copyright (C) 2013-2018 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org @@ -67,8 +67,8 @@ void loop() c++; // A debug message - DEBUG_OUTPUT(PSTR("DEBUG\nc=%" PRId16 "\nmillis=" PRId32 "\n"), c, hwMillis()); + DEBUG_OUTPUT(PSTR("DEBUG\nc=%" PRId16 "\nmillis=%" PRId32 "\n"), c, hwMillis()); // Send a log message with ACK to a node - OTALog(0, true, PSTR("LOG\nc=%" PRId16 "\nmillis=" PRId32 "\n"), c, hwMillis()); -} + OTALog(0, true, PSTR("LOG\nc=%" PRId16 "\nmillis=%" PRId32 "\n"), c, hwMillis()); +} \ No newline at end of file diff --git a/hal/architecture/SAMD/MyHwSAMD.h b/hal/architecture/SAMD/MyHwSAMD.h index a567092..178ec10 100644 --- a/hal/architecture/SAMD/MyHwSAMD.h +++ b/hal/architecture/SAMD/MyHwSAMD.h @@ -40,6 +40,7 @@ extEEPROM eep(MY_EXT_EEPROM_SIZE, 1, MY_EXT_EEPROM_PAGE_SIZE, #define MIN(a,b) min(a,b) #define MAX(a,b) max(a,b) #define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) +#define vsnprintf_P(s, n, f, ...) vsnprintf((s), (n), (f), __VA_ARGS__) // Define these as macros to save valuable space #define hwDigitalWrite(__pin, __value) digitalWrite(__pin, __value)