The RF42Mesh lib has its debugging output statements hardcoded to only work on certain boards, while RF24 has its debugging outputs to rely on RF24/printf.h & _RF24config.h. This presents a problem as I've recently expanded the printf mechanism to use more boards (including the Aduino Nano 33 BLE using arduino's MBED core and all boards supported by adaruit's fork of arduino's SAMD core).
I noticed this when testing RF24Mesh examples on my Adafruit QtPy (ATSAMD21) board - no debugging output from RF24Mesh and some faulty/missing debug output from RF24Network (e.g. it doesn't print message data in <millis()>: FRG message <%02x for each char in message>).
Solution
change all
#if defined (MESH_DEBUG)
printf("%u: MSH <statement>\n", millis())
#endif
where IF_MESH_DEBUG would be defined in _RF24Meshconfig.h like
#if defined (MESH_DEBUG)
#define IF_MESH_DEBUG(x) ({x;})
#else
#define IF_MESH_DEBUG(x)
#endif
Additional Context
Since we don't need to include everything from _RF24config.h, I was thinking the printf_P related stuff could be abstracted (away from the RF24 utility driver stuff) into its own header (in RF24 lib) called _printfcompatibility.h, but I need to investigate more...
I will also fix the warning in the Arduino compiler output about using %u where it should be %lu because millis() is an unsigned long, and unsigned int is the fallback when no data type is specified (like with %u).
All of this should be considered a temporary workaround until we finalize the RF24Log library.
The RF42Mesh lib has its debugging output statements hardcoded to only work on certain boards, while RF24 has its debugging outputs to rely on RF24/printf.h & _RF24config.h. This presents a problem as I've recently expanded the printf mechanism to use more boards (including the Aduino Nano 33 BLE using arduino's MBED core and all boards supported by adaruit's fork of arduino's SAMD core).
I noticed this when testing RF24Mesh examples on my Adafruit QtPy (ATSAMD21) board - no debugging output from RF24Mesh and some faulty/missing debug output from RF24Network (e.g. it doesn't print message data in
<millis()>: FRG message <%02x for each char in message>
).Solution
change all
to
where
IF_MESH_DEBUG
would be defined in _RF24Meshconfig.h likeAdditional Context
Since we don't need to include everything from _RF24config.h, I was thinking the
printf_P
related stuff could be abstracted (away from the RF24 utility driver stuff) into its own header (in RF24 lib) called _printfcompatibility.h, but I need to investigate more...I will also fix the warning in the Arduino compiler output about using
%u
where it should be%lu
becausemillis()
is an unsigned long, and unsigned int is the fallback when no data type is specified (like with%u
).All of this should be considered a temporary workaround until we finalize the RF24Log library.