Skip to content

Commit efe0475

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

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-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

+35-3
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,49 @@
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+
{ \
52+
WS_PRINTER.print(__VA_ARGS__); \
53+
yield(); \
54+
} ///< Prints line from debug output.
55+
#define WS_DEBUG_PRINTLN(...) \
56+
{ \
57+
WS_PRINTER.println(__VA_ARGS__); \
58+
yield(); \
59+
} ///< Prints line from debug output.
60+
#define WS_DEBUG_PRINTHEX(...) \
61+
{ \
62+
WS_PRINTER.print(__VA_ARGS__, HEX); \
63+
yield(); \
64+
} ///< Prints debug output.
65+
#else
66+
#define WS_DEBUG_PRINT(...) \
67+
{ \
68+
WS_PRINTER.print(__VA_ARGS__); \
69+
WS_PRINTER.flush(); \
70+
yield(); \
71+
} ///< Prints line from debug output.
5172
#define WS_DEBUG_PRINTLN(...) \
52-
{ WS_PRINTER.println(__VA_ARGS__); } ///< Prints line from debug output.
73+
{ \
74+
WS_PRINTER.println(__VA_ARGS__); \
75+
WS_PRINTER.flush(); \
76+
yield(); \
77+
} ///< Prints line from debug output.
5378
#define WS_DEBUG_PRINTHEX(...) \
54-
{ WS_PRINTER.print(__VA_ARGS__, HEX); } ///< Prints debug output.
79+
{ \
80+
WS_PRINTER.print(__VA_ARGS__, HEX); \
81+
WS_PRINTER.flush(); \
82+
yield(); \
83+
} ///< Prints debug output.
84+
#endif
5585
#else
5686
#define WS_DEBUG_PRINT(...) \
5787
{} ///< Prints debug output
5888
#define WS_DEBUG_PRINTLN(...) \
5989
{} ///< Prints line from debug output.
90+
#define WS_DEBUG_PRINTHEX(...) \
91+
{} ///< Prints debug output.
6092
#endif
6193

6294
#define WS_DELAY_WITH_WDT(timeout) \

0 commit comments

Comments
 (0)