to debug or not to debug
-
Hi All,
Just as question: Does it have a lot of influence if I leave the debug option "on" when I install a (new) node?
I used to do so (I always leave debug on) but I can imagine it has effect on performance. Or is this irrelevant
BR,
Boozz
-
@boozz A quick research told me - yes, it could have a lot of influence. Especially when using low buad rate and sending a lot of characters over serial line. Of course there are other ways to debug.
-
If you do a lot of screen drawing, play sound or anything that requires precise timing, running with debug might have an effect. But if it did, you would have noticed it when you tested the node. So performance-wise you can probably leave it on.
However, if your node is battery-powered, having the serial chip active might hurt battery life. Therefore I disable debug before deploying nodes.
If you add your own debug statements in your sketch, this makes it easy to turn them off (I got the idea from here
#ifdef DEBUG #define debuglogln(args...) Serial.println(args) #else #define debuglogln(args...) #endif void setup() { #ifdef DEBUG Serial.begin(BAUD_RATE); #endif debuglogln("hello"); ...
If you turn DEBUG off, debuglogln will do nothing. If DEBUG is on, all debuglogln statements will work as Serial.println. You can do the same for Serial.print (without ln) if you use that.
-
Thank you both for the contributions.
@mfalkvidd: Thanks a lot for pointing me towards the technique to turn it on /off. This will become very handy in the future for sure.
BR,
Boozz
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
MQTT-Help me understand about the MQTT Gateway.
Development • 24 days ago • dpcons 13 days ago -
Home Assistant/MySensors quirks
Development • 9 days ago • OldSurferDude 9 days ago -
Radio waking up for no reason.
Development • 4 Jul 2020, 21:09 • Sasquatch 15 Jan 2025, 08:33 -
LAN8720A - will mysensors work with this module
Development • 13 Nov 2024, 17:06 • Marcin 15 Nov 2024, 10:59 -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14