Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. to debug or not to debug

to debug or not to debug

Scheduled Pinned Locked Moved Development
4 Posts 3 Posters 1.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    boozz
    wrote on last edited by
    #1

    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:flushed:

    BR,

    Boozz

    m26872M 1 Reply Last reply
    0
    • B boozz

      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:flushed:

      BR,

      Boozz

      m26872M Offline
      m26872M Offline
      m26872
      Hardware Contributor
      wrote on last edited by
      #2

      @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.

      1 Reply Last reply
      0
      • mfalkviddM Offline
        mfalkviddM Offline
        mfalkvidd
        Mod
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        3
        • B Offline
          B Offline
          boozz
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          1
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          7

          Online

          11.7k

          Users

          11.2k

          Topics

          113.1k

          Posts


          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • MySensors
          • OpenHardware.io
          • Categories
          • Recent
          • Tags
          • Popular