Skip to content

Commit 2c614b4

Browse files
committed
Flush after debug prints, except SAMD (flush routine too big for SAMD21)
1 parent 16bc28a commit 2c614b4

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/Wippersnapper.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -2711,8 +2711,10 @@ void print_reset_reason(int reason) {
27112711
*/
27122712
/**************************************************************************/
27132713
void printDeviceInfo() {
2714+
WS_PRINTER.flush();
27142715
WS_DEBUG_PRINTLN("-------Device Information-------");
27152716
WS_DEBUG_PRINT("Firmware Version: ");
2717+
WS_PRINTER.flush();
27162718
WS_DEBUG_PRINTLN(WS_VERSION);
27172719
WS_DEBUG_PRINT("Board ID: ");
27182720
WS_DEBUG_PRINTLN(BOARD_ID);

src/Wippersnapper.h

+14-3
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,28 @@
4646

4747
// Define actual debug output functions when necessary.
4848
#ifdef WS_DEBUG
49+
#if defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRWIFI1010)
4950
#define WS_DEBUG_PRINT(...) \
50-
{ WS_PRINTER.print(__VA_ARGS__); } ///< Prints debug output.
51+
{ WS_PRINTER.print(__VA_ARGS__); yield(); } ///< Prints line from debug output.
5152
#define WS_DEBUG_PRINTLN(...) \
52-
{ WS_PRINTER.println(__VA_ARGS__); } ///< Prints line from debug output.
53+
{ WS_PRINTER.println(__VA_ARGS__); yield(); } ///< Prints line from debug output.
5354
#define WS_DEBUG_PRINTHEX(...) \
54-
{ WS_PRINTER.print(__VA_ARGS__, HEX); } ///< Prints debug output.
55+
{ WS_PRINTER.print(__VA_ARGS__, HEX); yield(); } ///< Prints debug output.
56+
#else
57+
#define WS_DEBUG_PRINT(...) \
58+
{ WS_PRINTER.print(__VA_ARGS__); WS_PRINTER.flush(); yield(); } ///< Prints line from debug output.
59+
#define WS_DEBUG_PRINTLN(...) \
60+
{ WS_PRINTER.println(__VA_ARGS__); WS_PRINTER.flush(); yield(); } ///< Prints line from debug output.
61+
#define WS_DEBUG_PRINTHEX(...) \
62+
{ WS_PRINTER.print(__VA_ARGS__, HEX); WS_PRINTER.flush(); yield(); } ///< Prints debug output.
63+
#endif
5564
#else
5665
#define WS_DEBUG_PRINT(...) \
5766
{} ///< Prints debug output
5867
#define WS_DEBUG_PRINTLN(...) \
5968
{} ///< Prints line from debug output.
69+
#define WS_DEBUG_PRINTHEX(...) \
70+
{} ///< Prints debug output.
6071
#endif
6172

6273
#define WS_DELAY_WITH_WDT(timeout) \

0 commit comments

Comments
 (0)