Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE - Flush after debug prints, except SAMD (flush routine too big for SAMD21) #671

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Wippersnapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2711,8 +2711,10 @@ void print_reset_reason(int reason) {
*/
/**************************************************************************/
void printDeviceInfo() {
WS_PRINTER.flush();
WS_DEBUG_PRINTLN("-------Device Information-------");
WS_DEBUG_PRINT("Firmware Version: ");
WS_PRINTER.flush();
WS_DEBUG_PRINTLN(WS_VERSION);
WS_DEBUG_PRINT("Board ID: ");
WS_DEBUG_PRINTLN(BOARD_ID);
Expand Down
38 changes: 35 additions & 3 deletions src/Wippersnapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,49 @@

// Define actual debug output functions when necessary.
#ifdef WS_DEBUG
#if defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRWIFI1010)
#define WS_DEBUG_PRINT(...) \
{ WS_PRINTER.print(__VA_ARGS__); } ///< Prints debug output.
{ \
WS_PRINTER.print(__VA_ARGS__); \
yield(); \
} ///< Prints line from debug output.
#define WS_DEBUG_PRINTLN(...) \
{ \
WS_PRINTER.println(__VA_ARGS__); \
yield(); \
} ///< Prints line from debug output.
#define WS_DEBUG_PRINTHEX(...) \
{ \
WS_PRINTER.print(__VA_ARGS__, HEX); \
yield(); \
} ///< Prints debug output.
#else
#define WS_DEBUG_PRINT(...) \
{ \
WS_PRINTER.print(__VA_ARGS__); \
WS_PRINTER.flush(); \
yield(); \
} ///< Prints line from debug output.
#define WS_DEBUG_PRINTLN(...) \
{ WS_PRINTER.println(__VA_ARGS__); } ///< Prints line from debug output.
{ \
WS_PRINTER.println(__VA_ARGS__); \
WS_PRINTER.flush(); \
yield(); \
} ///< Prints line from debug output.
#define WS_DEBUG_PRINTHEX(...) \
{ WS_PRINTER.print(__VA_ARGS__, HEX); } ///< Prints debug output.
{ \
WS_PRINTER.print(__VA_ARGS__, HEX); \
WS_PRINTER.flush(); \
yield(); \
} ///< Prints debug output.
#endif
#else
#define WS_DEBUG_PRINT(...) \
{} ///< Prints debug output
#define WS_DEBUG_PRINTLN(...) \
{} ///< Prints line from debug output.
#define WS_DEBUG_PRINTHEX(...) \
{} ///< Prints debug output.
#endif

#define WS_DELAY_WITH_WDT(timeout) \
Expand Down
Loading