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 -
PJON and Minicore not working
Development • 12 days ago • Trand 12 days ago -
Counting Incoming and Outgoing Messages from a Gateway
Development • 10 Dec 2024, 21:57 • Trand 14 Dec 2024, 20:23 -
MQTT-Help me understand about the MQTT Gateway.
Development • 2 Mar 2025, 01:44 • dpcons 21 days ago -
Home Assistant/MySensors quirks
Development • 16 days ago • OldSurferDude 16 days ago -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14