Zepp-Hanzj commented on code in PR #3524:
URL: https://github.com/apache/nuttx-apps/pull/3524#discussion_r3359957984


##########
system/uorb/sensor/step_counter.c:
##########
@@ -30,10 +30,8 @@
  * Private Functions
  ****************************************************************************/
 
-#ifdef CONFIG_DEBUG_UORB

Review Comment:
   You're right, I didn't think this through carefully. Removing all #ifdef 
CONFIG_DEBUG_UORB guards unconditionally will indeed increase the image size 
with no way to opt out.
   
   Here's a revised approach I'd like to propose:
   
   Introduce a new CONFIG_UORB_FORMAT option to control whether format strings 
are compiled in:
   
   1.Add config UORB_FORMAT in system/uorb/Kconfig
   2.CONFIG_DEBUG_UORB will select UORB_FORMAT (so debug output still works as 
before)
   3.CONFIG_UORB_LISTENER will also select UORB_FORMAT (so listener can display 
data)
   4.All #ifdef CONFIG_DEBUG_UORB guards around format strings, o_format field, 
orb_info()/orb_fprintf()/orb_sscanf() will be changed to #ifdef 
CONFIG_UORB_FORMAT
   
   This way:
   
   1.Debug + listener users: format strings are automatically included (same as 
before)
   2.Neither debug nor listener users: format strings are excluded, no image 
size increase
   3.Users can also manually disable UORB_FORMAT even with listener enabled, if 
they prefer smaller images and don't need formatted output
   
   The changes would be ~6 locations in uORB.h, uORB.c, listener.c, Kconfig, 
plus 43 sensor files (simple CONFIG_DEBUG_UORB → CONFIG_UORB_FORMAT 
replacement).
   
   Would this approach be acceptable?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to