Otpvondoiats opened a new pull request, #3389:
URL: https://github.com/apache/nuttx-apps/pull/3389

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   This patch series refactors the uORB subscription API by changing from 
negative "non-wakeup" semantics to positive "wakeup" semantics, aligning with 
Android's sensor framework approach. Additionally, it adds proper support for 
uncalibrated sensor types and improves test infrastructure.
   
   Motivation
   The original uORB API used confusing negative logic with "non-wakeup" mode 
as the default, making it counter-intuitive for developers. This series 
addresses multiple issues:
   
   Confusing API semantics: "non-wakeup" mode (default) created double 
negatives in code
   Android alignment: Android uses "wakeup" sensors with positive logic
   Missing uncalibrated support: Nine-axis uncalibrated sensors lacked proper 
data structures
   Test issues: Unit tests included latency tests that should be run separately
   Key Changes
   1. API Semantic Reversal: Non-Wakeup → Wakeup
   Changed from negative to positive logic for better clarity:
   
   Before (confusing):
   
   After (intuitive):
   
   Rationale:
   
   Non-wakeup is default (most power-efficient)
   Positive logic eliminates double negatives
   Clear distinction: orb_subscribe_multi() vs orb_subscribe_multi_wakeup()
   Matches Android sensor HAL conventions
   2. API Changes
   Removed APIs:
   
   Added APIs:
   
   Updated Internal APIs:
   
   3. uorb_listener Tool Updates
   Updated command-line interface to match new semantics:
   
   Before:
   
   After:
   
   Default behavior remains non-wakeup (power-efficient), but option is now 
positive logic.
   
   4. Uncalibrated Sensor Type Support
   Added proper data structures and format strings for uncalibrated nine-axis 
sensors:
   
   New Structures:
   
   Updated Topic Definitions:
   
   5. Unit Test Improvements
   Removed automatic latency test:
   
   Latency tests are timing-sensitive and should be run explicitly
   Removed from default unit test execution to prevent false failures
   Can still be run manually: unit_test latency_test
   Improved test output:
   
   Technical Details
   Modified Files:
   
   system/uorb/uORB/uORB.h - API declarations
   system/uorb/uORB/uORB.c - Core implementation
   listener.c - Command-line tool updates
   system/uorb/sensor/accel.c - Uncalibrated accel support
   system/uorb/sensor/gyro.c - Uncalibrated gyro support
   system/uorb/sensor/mag.c - Uncalibrated mag support
   system/uorb/test/unit_test.c - Test improvements
   Code Changes Summary:
   
   60 insertions, 58 deletions across 7 files
   Mostly semantic renaming and structure corrections
   No functional behavior changes (except latency test)
   
   ## Impact
   
   API Changes (Breaking)
   Removed API:
   
   orb_subscribe_multi_nonwakeup() - replaced by default behavior
   Added API:
   
   orb_subscribe_multi_wakeup() - explicit wakeup subscriptions
   Migration Required:
   
   Users
   Clearer API: Positive "wakeup" logic easier to understand than negative 
"non-wakeup"
   Better Defaults: Non-wakeup remains default (most power-efficient)
   Android Compatible: Matches Android sensor HAL semantics
   Proper Uncalibrated Support: Nine-axis uncalibrated sensors now have correct 
data structures
   Applications
   uorb_listener: Changed -u flag to -w flag (semantic flip)
   Sensor Apps: Apps using uncalibrated sensors get proper bias data
   Power Sensitive Apps: Clearer API makes power management intent explicit
   Build Process
   No impact on build process
   Source-level compatibility broken (requires migration)
   Binary compatibility maintained for non-breaking paths
   Testing
   Unit tests more reliable (latency test separated)
   Better test output formatting
   Explicit test invocation: unit_test vs unit_test latency_test
   
   ## Testing
   
   ~~~
   
   ap> [29/01/26 12:35:55.835863] [62] [ap] 
[CHARGERD]charger_statemachine_state_run: change state 3 to 1
   [29/01/26 12:35:55.864611] [62] [ap] 
[CHARGERD]charger_statemachine_state_run: change state 1 to 3
   uorb_listener[01/29 12:35:56] [21] [sensor] [AlgoDaily] DailySum pub rt, 
step:0, cal:0, stress:0
   , spo2:0
    -n 10  sensor_accel
   
   Mointor objects num:1
   object_name:sensor_accel, object_instance:0
   [01/29 12:35:58] [ 0] [audio] CPU USAGE: busy=1 cpu_sleep=0 bus_sleep=0 
subsys_sleep=99(pd)
   
sensor_accel(now:64308463806):timestamp:64286113348,x:-0.081826,y:-0.097826,z:9.775804,temperature:29.474609
   
sensor_accel(now:64308464233):timestamp:64286153570,x:-0.045913,y:-0.102614,z:9.802140,temperature:29.474609
   
sensor_accel(now:64308465637):timestamp:64286193792,x:0.001971,y:-0.133739,z:9.871572,temperature:29.474609
   
sensor_accel(now:64308466979):timestamp:64286234014,x:-0.012394,y:-0.097826,z:9.727920,temperature:29.474609
   
sensor_accel(now:64308468383):timestamp:64286274236,x:-0.079431,y:-0.150498,z:9.826082,temperature:29.474609
   
sensor_accel(now:64308469726):timestamp:64286314458,x:-0.029153,y:-0.102614,z:9.794957,temperature:29.474609
   
sensor_accel(now:64308471130):timestamp:64286354680,x:-0.019576,y:-0.085855,z:9.773410,temperature:29.474609
   
sensor_accel(now:64308472473):timestamp:64286394902,x:-0.057884,y:-0.105009,z:9.885937,temperature:29.474609
   
sensor_accel(now:64308473876):timestamp:64286435124,x:-0.005211,y:-0.100220,z:9.838053,temperature:29.474609
   
sensor_accel(now:64308475219):timestamp:64286475346,x:-0.067460,y:-0.042759,z:9.682429,temperature:29.474609
   Object name:sensor_accel0, recieved:10
   Total number of received Message:10/10
   ~~~
   
   


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