Skip to content

Commit

Permalink
uorb:Fixed the abnormal issue of printing uint16 with PRIu16.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Otpvondoiats authored and xiaoxiang781216 committed Oct 18, 2024
1 parent 8b17cfe commit 06181f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion system/uorb/sensor/ppgd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

/****************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions system/uorb/sensor/ppgq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

/****************************************************************************
Expand Down

0 comments on commit 06181f0

Please sign in to comment.