AVR: Fix OTA logging (#1074)
This commit is contained in:
@@ -36,11 +36,7 @@ void OTALog(uint8_t logNode, bool enableAck, const char *fmt, ... )
|
|||||||
|
|
||||||
// create message
|
// create message
|
||||||
va_start (args, fmt );
|
va_start (args, fmt );
|
||||||
#ifdef vsnprintf_P
|
|
||||||
int n = vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
int n = vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
||||||
#else
|
|
||||||
int n = vsnprintf(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
|
||||||
#endif
|
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
// Check number of chars
|
// Check number of chars
|
||||||
@@ -92,14 +88,9 @@ void OTALogPrintPrefix()
|
|||||||
{
|
{
|
||||||
char prefix[37];
|
char prefix[37];
|
||||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||||
#ifdef snprintf_P
|
|
||||||
snprintf_P(prefix, sizeof(prefix),
|
snprintf_P(prefix, sizeof(prefix),
|
||||||
PSTR("%" PRId8 ";%" PRId8 ";%" PRId8 ";0;%" PRId8 ";%" PRIu32 " "),
|
PSTR("%" PRId8 ";%" PRId8 ";%" PRId8 ";0;%" PRId8 ";%" PRIu32 " "),
|
||||||
OTALogBufferNode, OTALogBufferSensor, C_INTERNAL, I_LOG_MESSAGE, hwMillis());
|
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);
|
MY_SERIALDEVICE.print(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* network topology allowing messages to be routed to nodes.
|
* network topology allowing messages to be routed to nodes.
|
||||||
*
|
*
|
||||||
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
|
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
|
||||||
* Copyright (C) 2013-2015 Sensnology AB
|
* Copyright (C) 2013-2018 Sensnology AB
|
||||||
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
|
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
|
||||||
*
|
*
|
||||||
* Documentation: http://www.mysensors.org
|
* Documentation: http://www.mysensors.org
|
||||||
@@ -67,8 +67,8 @@ void loop()
|
|||||||
c++;
|
c++;
|
||||||
|
|
||||||
// A debug message
|
// 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
|
// 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());
|
||||||
}
|
}
|
||||||
@@ -40,6 +40,7 @@ extEEPROM eep(MY_EXT_EEPROM_SIZE, 1, MY_EXT_EEPROM_PAGE_SIZE,
|
|||||||
#define MIN(a,b) min(a,b)
|
#define MIN(a,b) min(a,b)
|
||||||
#define MAX(a,b) max(a,b)
|
#define MAX(a,b) max(a,b)
|
||||||
#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__)
|
#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 these as macros to save valuable space
|
||||||
#define hwDigitalWrite(__pin, __value) digitalWrite(__pin, __value)
|
#define hwDigitalWrite(__pin, __value) digitalWrite(__pin, __value)
|
||||||
|
|||||||
Reference in New Issue
Block a user