Skip to content

Commit 06181f0

Browse files
Otpvondoiatsxiaoxiang781216
authored andcommitted
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 <[email protected]>
1 parent 8b17cfe commit 06181f0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

system/uorb/sensor/ppgd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#ifdef CONFIG_DEBUG_UORB
3232
static const char sensor_ppgd_format[] =
3333
"timestamp:%" PRIu64 ",ppg0:%" PRIu32 ",ppg1:%" PRIu32 ","
34-
"current:%" PRIu32 ",gain0:%" PRIu16 ",gain1:%" PRIu16 "";
34+
"current:%" PRIu32 ",gain0:%hu,gain1:%hu";
3535
#endif
3636

3737
/****************************************************************************

system/uorb/sensor/ppgq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
#ifdef CONFIG_DEBUG_UORB
3232
static const char sensor_ppgq_format[] =
3333
"timestamp:%" PRIu64 ",ppg0:%" PRIu32 ",ppg1:%" PRIu32 ",ppg2:%" PRIu32 ","
34-
"ppg3:%" PRIu32 ",current:%" PRIu32 ",gain0:%" PRIu16 ",gain1:%" PRIu16 ","
35-
"gain2:%" PRIu16 ",gain3:%" PRIu16 "";
34+
"ppg3:%" PRIu32 ",current:%" PRIu32 ",gain0:%hu,gain1:%hu,gain2:%hu,"
35+
"gain3:%hu";
3636
#endif
3737

3838
/****************************************************************************

0 commit comments

Comments
 (0)