Remove duplicate va_end()
This commit is contained in:
@@ -198,22 +198,21 @@ uint16_t hwFreeMem() {
|
|||||||
|
|
||||||
#ifdef MY_DEBUG
|
#ifdef MY_DEBUG
|
||||||
void hwDebugPrint(const char *fmt, ... ) {
|
void hwDebugPrint(const char *fmt, ... ) {
|
||||||
char fmtBuffer[300];
|
char fmtBuffer[MY_DEBUG_BUFFER_SIZE];
|
||||||
#ifdef MY_GATEWAY_FEATURE
|
#ifdef MY_GATEWAY_FEATURE
|
||||||
// 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)
|
||||||
snprintf_P(fmtBuffer, 299, PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
||||||
MY_SERIALDEVICE.print(fmtBuffer);
|
MY_SERIALDEVICE.print(fmtBuffer);
|
||||||
#endif
|
#endif
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start (args, fmt );
|
va_start (args, fmt );
|
||||||
va_end (args);
|
|
||||||
#ifdef MY_GATEWAY_FEATURE
|
#ifdef MY_GATEWAY_FEATURE
|
||||||
// Truncate message if this is gateway node
|
// Truncate message if this is gateway node
|
||||||
vsnprintf_P(fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, fmt, args);
|
vsnprintf_P(fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, fmt, args);
|
||||||
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1] = '\n';
|
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1] = '\n';
|
||||||
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH] = '\0';
|
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH] = '\0';
|
||||||
#else
|
#else
|
||||||
vsnprintf_P(fmtBuffer, 299, fmt, args);
|
vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
||||||
#endif
|
#endif
|
||||||
va_end (args);
|
va_end (args);
|
||||||
MY_SERIALDEVICE.print(fmtBuffer);
|
MY_SERIALDEVICE.print(fmtBuffer);
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MY_SERIALDEVICE Serial
|
#define MY_SERIALDEVICE Serial
|
||||||
|
#define MY_DEBUG_BUFFER_SIZE 300
|
||||||
|
|
||||||
#if defined __AVR_ATmega328P__
|
#if defined __AVR_ATmega328P__
|
||||||
#ifndef sleep_bod_disable
|
#ifndef sleep_bod_disable
|
||||||
#define sleep_bod_disable() \
|
#define sleep_bod_disable() \
|
||||||
|
|||||||
@@ -132,22 +132,21 @@ uint16_t hwFreeMem() {
|
|||||||
|
|
||||||
#ifdef MY_DEBUG
|
#ifdef MY_DEBUG
|
||||||
void hwDebugPrint(const char *fmt, ... ) {
|
void hwDebugPrint(const char *fmt, ... ) {
|
||||||
char fmtBuffer[300];
|
char fmtBuffer[MY_DEBUG_BUFFER_SIZE];
|
||||||
#ifdef MY_GATEWAY_FEATURE
|
#ifdef MY_GATEWAY_FEATURE
|
||||||
// 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)
|
||||||
snprintf_P(fmtBuffer, 299, PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
||||||
MY_SERIALDEVICE.print(fmtBuffer);
|
MY_SERIALDEVICE.print(fmtBuffer);
|
||||||
#endif
|
#endif
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start (args, fmt );
|
va_start (args, fmt );
|
||||||
va_end (args);
|
|
||||||
#ifdef MY_GATEWAY_FEATURE
|
#ifdef MY_GATEWAY_FEATURE
|
||||||
// Truncate message if this is gateway node
|
// Truncate message if this is gateway node
|
||||||
vsnprintf_P(fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, fmt, args);
|
vsnprintf_P(fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, fmt, args);
|
||||||
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1] = '\n';
|
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1] = '\n';
|
||||||
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH] = '\0';
|
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH] = '\0';
|
||||||
#else
|
#else
|
||||||
vsnprintf_P(fmtBuffer, 299, fmt, args);
|
vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
||||||
#endif
|
#endif
|
||||||
va_end (args);
|
va_end (args);
|
||||||
MY_SERIALDEVICE.print(fmtBuffer);
|
MY_SERIALDEVICE.print(fmtBuffer);
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MY_SERIALDEVICE Serial
|
#define MY_SERIALDEVICE Serial
|
||||||
|
#define MY_DEBUG_BUFFER_SIZE 300
|
||||||
|
|
||||||
#define min(a,b) ((a)<(b)?(a):(b))
|
#define min(a,b) ((a)<(b)?(a):(b))
|
||||||
#define max(a,b) ((a)>(b)?(a):(b))
|
#define max(a,b) ((a)>(b)?(a):(b))
|
||||||
|
|
||||||
|
|||||||
+3
-4
@@ -156,22 +156,21 @@ uint16_t hwFreeMem() {
|
|||||||
#ifdef MY_DEBUG
|
#ifdef MY_DEBUG
|
||||||
void hwDebugPrint(const char *fmt, ... ) {
|
void hwDebugPrint(const char *fmt, ... ) {
|
||||||
if (MY_SERIALDEVICE) {
|
if (MY_SERIALDEVICE) {
|
||||||
char fmtBuffer[300];
|
char fmtBuffer[MY_DEBUG_BUFFER_SIZE];
|
||||||
#ifdef MY_GATEWAY_FEATURE
|
#ifdef MY_GATEWAY_FEATURE
|
||||||
// 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)
|
||||||
snprintf(fmtBuffer, 299, PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
snprintf(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
||||||
MY_SERIALDEVICE.print(fmtBuffer);
|
MY_SERIALDEVICE.print(fmtBuffer);
|
||||||
#endif
|
#endif
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start (args, fmt );
|
va_start (args, fmt );
|
||||||
va_end (args);
|
|
||||||
#ifdef MY_GATEWAY_FEATURE
|
#ifdef MY_GATEWAY_FEATURE
|
||||||
// Truncate message if this is gateway node
|
// Truncate message if this is gateway node
|
||||||
vsnprintf(fmtBuffer, 60, fmt, args);
|
vsnprintf(fmtBuffer, 60, fmt, args);
|
||||||
fmtBuffer[59] = '\n';
|
fmtBuffer[59] = '\n';
|
||||||
fmtBuffer[60] = '\0';
|
fmtBuffer[60] = '\0';
|
||||||
#else
|
#else
|
||||||
vsnprintf(fmtBuffer, 299, fmt, args);
|
vsnprintf(fmtBuffer, sizeof(fmtBuffer), fmt, args);
|
||||||
#endif
|
#endif
|
||||||
va_end (args);
|
va_end (args);
|
||||||
MY_SERIALDEVICE.print(fmtBuffer);
|
MY_SERIALDEVICE.print(fmtBuffer);
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ void hwWriteConfig(int adr, uint8_t value);
|
|||||||
uint8_t hwReadConfig(int adr);
|
uint8_t hwReadConfig(int adr);
|
||||||
|
|
||||||
#define MY_SERIALDEVICE SerialUSB
|
#define MY_SERIALDEVICE SerialUSB
|
||||||
|
#define MY_DEBUG_BUFFER_SIZE 300
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user