You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/10/18 11:57:03 UTC

(nuttx-apps) branch master updated: uorb:Fixed the abnormal issue of printing uint16 with PRIu16.

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 06181f0b0 uorb:Fixed the abnormal issue of printing uint16 with PRIu16.
06181f0b0 is described below

commit 06181f0b00ab4f76bc6b58ece0a18236df00503c
Author: likun17 <li...@xiaomi.com>
AuthorDate: Fri Oct 11 16:30:58 2024 +0800

    uorb:Fixed the abnormal issue of printing uint16 with PRIu16.
    
    The PRIu16 macro in the system is defined as "u", and "hu" is required.
    In Linux and Nuttx, PRIu32 PRIu16 PRIu8 are all defined as "u", but %pB
    prints the structure and needs its offset. %pB gets the offset through
    sizeof(short int)
    
    Signed-off-by: likun17 <li...@xiaomi.com>
---
 system/uorb/sensor/ppgd.c | 2 +-
 system/uorb/sensor/ppgq.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/system/uorb/sensor/ppgd.c b/system/uorb/sensor/ppgd.c
index abac23e60..574f8928b 100644
--- a/system/uorb/sensor/ppgd.c
+++ b/system/uorb/sensor/ppgd.c
@@ -31,7 +31,7 @@
 #ifdef CONFIG_DEBUG_UORB
 static const char sensor_ppgd_format[] =
   "timestamp:%" PRIu64 ",ppg0:%" PRIu32 ",ppg1:%" PRIu32 ","
-  "current:%" PRIu32 ",gain0:%" PRIu16 ",gain1:%" PRIu16 "";
+  "current:%" PRIu32 ",gain0:%hu,gain1:%hu";
 #endif
 
 /****************************************************************************
diff --git a/system/uorb/sensor/ppgq.c b/system/uorb/sensor/ppgq.c
index 89e6e592c..108710533 100644
--- a/system/uorb/sensor/ppgq.c
+++ b/system/uorb/sensor/ppgq.c
@@ -31,8 +31,8 @@
 #ifdef CONFIG_DEBUG_UORB
 static const char sensor_ppgq_format[] =
   "timestamp:%" PRIu64 ",ppg0:%" PRIu32 ",ppg1:%" PRIu32 ",ppg2:%" PRIu32 ","
-  "ppg3:%" PRIu32 ",current:%" PRIu32 ",gain0:%" PRIu16 ",gain1:%" PRIu16 ","
-  "gain2:%" PRIu16 ",gain3:%" PRIu16 "";
+  "ppg3:%" PRIu32 ",current:%" PRIu32 ",gain0:%hu,gain1:%hu,gain2:%hu,"
+  "gain3:%hu";
 #endif
 
 /****************************************************************************