Zepp-Hanzj opened a new pull request, #3527:
URL: https://github.com/apache/nuttx-apps/pull/3527

   Fixes apache/nuttx-apps#3202
   
   ## Problem
   
   `uorb_listener -T` (top mode) only displays the header row but no topic data:
   
   ```
   current objects: 1
   NAME                           INST #SUB RATE #Q SIZE
   ```
   
   ## Root Cause
   
   `listener_update()` only prints topic data when `delta_generation && 
delta_time` is true (i.e., new data arrived since the last check). In 
`listener_top`, the first iteration adds objects to the list via 
`listener_add_object()`, which records the current `generation` and 
`timestamp`. On subsequent iterations, if no new data has been published 
between calls, `delta_generation == 0` and the topic row is silently skipped.
   
   ## Fix
   
   Move the `uorbinfo_raw()` call and timestamp/generation update outside the 
`if (delta_generation && delta_time)` block in `listener_update()`. Initialize 
`frequency = 0` before the conditional so it defaults to 0 when no new data 
arrives. This ensures the topic row is always printed, showing the current 
state with frequency displayed as 0 when no new data is available.
   
   ## Verification
   
   Tested on `sim:nsh` with:
   
   ```
   CONFIG_USENSOR=y
   CONFIG_UORB=y
   CONFIG_UORB_LISTENER=y
   CONFIG_UORB_GENERATOR=y
   CONFIG_SENSORS=y
   CONFIG_SENSORS_FAKESENSOR=y
   CONFIG_DEBUG_UORB=y
   CONFIG_LINE_MAX=256
   CONFIG_NSH_MAXARGUMENTS=16
   ```
   
   Steps:
   ```
   nsh> uorb_generator -n 100000 -r 10 -s -t sensor_accel0 
timestamp:1,x:1,y:1,z:1,temperature:1 &
   nsh> sleep 3
   nsh> uorb_listener -T -l
   ```
   
   **Before fix:** Only header displayed, no topic rows.
   **After fix:**
   ```
   current objects: 1
   NAME                           INST #SUB RATE #Q SIZE
   sensor_accel                    0    0    8  1   24
   ```


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