Skip to content

RFD - Enable module-specific debug #800

@nickandrew

Description

@nickandrew

Debugging firmware errors with #define DEVELOP_VERSION results in excessive and unwanted debugging messages through the NODE_DBG() macro which is defined as c_printf when enabled, and nothing when disabled.

I suggest splitting NODE_DBG into one macro per module, which can be individually enabled in app/include/user_config.h. There'd be 30-40 of these macros, so a naming standard is required, and I suggest using DEBUG_MODULE_MODULENAME.

To start, I edited net.c:

#define DEBUG_MODULE_NET

and bulk-changed NODE_DBG to DEBUG_MODULE_NET

--- a/app/modules/net.c
+++ b/app/modules/net.c
@@ -59,7 +59,7 @@ typedef struct lnet_userdata

 static void net_server_disconnected(void *arg)    // for tcp server only
 {
-  NODE_DBG("net_server_disconnected is called.\n");
+  DEBUG_MODULE_NET("net_server_disconnected is called.\n");
   struct espconn *pesp_conn = arg;
   if(pesp_conn == NULL)
     return;

and that had the desired effect of eliminating just those messages, while leaving other debugging (which I added according to issue #795) intact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions