Make debug prints portable (#929)
This commit is contained in:
@@ -317,7 +317,7 @@ void hwDebugPrint(const char *fmt, ... )
|
||||
char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
|
||||
#ifdef MY_GATEWAY_SERIAL
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;%lu "),
|
||||
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%" PRIu8 ";0;%" PRIu8 ";%" PRIu32 " "),
|
||||
C_INTERNAL, I_LOG_MESSAGE, hwMillis());
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
#else
|
||||
@@ -336,5 +336,7 @@ void hwDebugPrint(const char *fmt, ... )
|
||||
va_end (args);
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
MY_SERIALDEVICE.flush();
|
||||
#else
|
||||
(void)fmt;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -153,8 +153,8 @@ void hwDebugPrint(const char *fmt, ... )
|
||||
char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
|
||||
#ifdef MY_GATEWAY_SERIAL
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;%lu "), C_INTERNAL, I_LOG_MESSAGE,
|
||||
hwMillis());
|
||||
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%" PRIu8 ";0;%" PRIu8 ";%" PRIu32 " "),
|
||||
C_INTERNAL, I_LOG_MESSAGE, hwMillis());
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
#else
|
||||
// prepend timestamp
|
||||
@@ -172,5 +172,7 @@ void hwDebugPrint(const char *fmt, ... )
|
||||
va_end (args);
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
MY_SERIALDEVICE.flush();
|
||||
#else
|
||||
(void)fmt;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* The MySensors Arduino library handles the wireless radio link and protocol
|
||||
* between your home built sensors/actuators and HA controller of choice.
|
||||
* The sensors forms a self healing radio network with optional repeaters. Each
|
||||
@@ -486,7 +486,7 @@ void hwDebugPrint(const char *fmt, ...)
|
||||
char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
|
||||
#ifdef MY_GATEWAY_SERIAL
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;%lu "),
|
||||
snprintf(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%" PRIu8 ";0;%" PRIu8 ";%" PRIu32 " "),
|
||||
C_INTERNAL, I_LOG_MESSAGE, hwMillis());
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
#else
|
||||
@@ -505,5 +505,7 @@ void hwDebugPrint(const char *fmt, ...)
|
||||
va_end (args);
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
MY_SERIALDEVICE.flush();
|
||||
#else
|
||||
(void)fmt;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -186,8 +186,8 @@ void hwDebugPrint(const char *fmt, ... )
|
||||
char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
|
||||
#ifdef MY_GATEWAY_SERIAL
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;%lu "), C_INTERNAL, I_LOG_MESSAGE,
|
||||
hwMillis());
|
||||
snprintf(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%" PRIu8 ";0;%" PRIu8 ";%" PRIu32 " "),
|
||||
C_INTERNAL, I_LOG_MESSAGE, hwMillis());
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
#else
|
||||
// prepend timestamp
|
||||
@@ -206,5 +206,7 @@ void hwDebugPrint(const char *fmt, ... )
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
// MY_SERIALDEVICE.flush();
|
||||
}
|
||||
#else
|
||||
(void)fmt;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* The MySensors Arduino library handles the wireless radio link and protocol
|
||||
* between your home built sensors/actuators and HA controller of choice.
|
||||
* The sensors forms a self healing radio network with optional repeaters. Each
|
||||
@@ -173,8 +173,8 @@ void hwDebugPrint(const char *fmt, ...)
|
||||
char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
|
||||
#ifdef MY_GATEWAY_SERIAL
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;%lu "), C_INTERNAL, I_LOG_MESSAGE,
|
||||
hwMillis());
|
||||
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%" PRIu8 ";0;%" PRIu8 ";%" PRIu32 " "),
|
||||
C_INTERNAL, I_LOG_MESSAGE, hwMillis());
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
#else
|
||||
// prepend timestamp
|
||||
@@ -194,5 +194,7 @@ void hwDebugPrint(const char *fmt, ...)
|
||||
// Disable flush since current STM32duino implementation performs a reset
|
||||
// instead of an actual flush
|
||||
//MY_SERIALDEVICE.flush();
|
||||
#else
|
||||
(void)fmt;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ void hwDebugPrint(const char *fmt, ...)
|
||||
char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
|
||||
#ifdef MY_GATEWAY_SERIAL
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;%lu "),
|
||||
snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%" PRIu8 ";0;%" PRIu8 ";%" PRIu32 " "),
|
||||
C_INTERNAL, I_LOG_MESSAGE, hwMillis());
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
#else
|
||||
@@ -189,5 +189,7 @@ void hwDebugPrint(const char *fmt, ...)
|
||||
#endif
|
||||
va_end(args);
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
#else
|
||||
(void)fmt;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user