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

DEBUG() #4

Open
copych opened this issue Apr 21, 2022 · 3 comments
Open

DEBUG() #4

copych opened this issue Apr 21, 2022 · 3 comments

Comments

@copych
Copy link

copych commented Apr 21, 2022

On the web I have found one smart tip, so suggest modifying sparkStructures.h with this:

#define DEBUG_ON          // Comment this line out for a production build

#ifdef DEBUG_ON
#define DEBUG(...) Serial.println(__VA_ARGS__) 
#else
#define DEBUG(...)
#endif

it can accept any number of args, like DEBUG(0x0170, HEX) , so there will be no more need to use print(). And globally (un-)defined DEBUG_ON could switch the entire project to clean production build.

@paulhamsh
Copy link
Owner

paulhamsh commented Apr 21, 2022 via email

@copych
Copy link
Author

copych commented Apr 21, 2022

It only duplicates what println can do. But it accepts concatenation: DEBUG("Hi " + String(12) + " people");

@copych
Copy link
Author

copych commented Apr 25, 2022

Sometimes .print is needed, so I modified my local copy as following:

#define DEBUG_ON          // Comment this line out for a production build

#ifdef DEBUG_ON
#define DEB(...) Serial.print(__VA_ARGS__) 
#define DEBUG(...) Serial.println(__VA_ARGS__) 
#else
#define DEB(...)
#define DEBUG(...)
#endif

this'd keep compatibility with the existing code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants