Skip to content

Commit d0e15a7

Browse files
Otpvondoiatsxiaoxiang781216
authored andcommitted
uorb:Adapt to new macro definition content.
Signed-off-by: likun17 <[email protected]>
1 parent dae4d75 commit d0e15a7

33 files changed

+116
-458
lines changed

system/uorb/sensor/accel.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,14 @@
2929
****************************************************************************/
3030

3131
#ifdef CONFIG_DEBUG_UORB
32-
static void print_sensor_accel_message(FAR const struct orb_metadata *meta,
33-
FAR const void *buffer)
34-
{
35-
FAR const struct sensor_accel *message = buffer;
36-
const orb_abstime now = orb_absolute_time();
32+
static const char sensor_accel_format[] =
33+
"timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf";
3734

38-
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) "
39-
"temperature: %.2f x: %.2f y: %.2f z: %.2f",
40-
meta->o_name, message->timestamp, now - message->timestamp,
41-
message->temperature, message->x, message->y, message->z);
42-
}
4335
#endif
4436

4537
/****************************************************************************
4638
* Public Data
4739
****************************************************************************/
4840

49-
ORB_DEFINE(sensor_accel, struct sensor_accel, print_sensor_accel_message);
50-
ORB_DEFINE(sensor_accel_uncal, struct sensor_accel,
51-
print_sensor_accel_message);
41+
ORB_DEFINE(sensor_accel, struct sensor_accel, sensor_accel_format);
42+
ORB_DEFINE(sensor_accel_uncal, struct sensor_accel, sensor_accel_format);

system/uorb/sensor/baro.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,12 @@
2929
****************************************************************************/
3030

3131
#ifdef CONFIG_DEBUG_UORB
32-
static void print_sensor_baro_message(FAR const struct orb_metadata *meta,
33-
FAR const void *buffer)
34-
{
35-
FAR const struct sensor_baro *message = buffer;
36-
const orb_abstime now = orb_absolute_time();
37-
38-
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) "
39-
"temperature: %.2f pressure: %.2f",
40-
meta->o_name, message->timestamp, now - message->timestamp,
41-
message->temperature, message->pressure);
42-
}
32+
static const char sensor_baro_format[] =
33+
"timestamp:%" PRIu64 ",pressure:%hf,temperature:%hf";
4334
#endif
4435

4536
/****************************************************************************
4637
* Public Data
4738
****************************************************************************/
4839

49-
ORB_DEFINE(sensor_baro, struct sensor_baro, print_sensor_baro_message);
40+
ORB_DEFINE(sensor_baro, struct sensor_baro, sensor_baro_format);

system/uorb/sensor/cap.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,13 @@
2929
****************************************************************************/
3030

3131
#ifdef CONFIG_DEBUG_UORB
32-
static void print_sensor_cap_message(FAR const struct orb_metadata *meta,
33-
FAR const void *buffer)
34-
{
35-
FAR const struct sensor_cap *message = buffer;
36-
const orb_abstime now = orb_absolute_time();
37-
38-
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) "
39-
"status: %" PRIu32 " rawdata0: %" PRIu32 " rawdata1: "
40-
"%" PRIu32 " rawdata2: %" PRIu32 " rawdata3: %" PRIu32 "",
41-
meta->o_name, message->timestamp, now - message->timestamp,
42-
message->status, message->rawdata[0], message->rawdata[1],
43-
message->rawdata[2], message->rawdata[3]);
44-
}
32+
static const char sensor_cap_format[] =
33+
"timestamp:%" PRIu64 ",status:%" PRIu32 ",rawdata0:%" PRIu32 ","
34+
"rawdata1:%" PRIu32 ",rawdata2:%" PRIu32 ",rawdata3:%" PRIu32 "";
4535
#endif
4636

4737
/****************************************************************************
4838
* Public Data
4939
****************************************************************************/
5040

51-
ORB_DEFINE(sensor_cap, struct sensor_cap, print_sensor_cap_message);
41+
ORB_DEFINE(sensor_cap, struct sensor_cap, sensor_cap_format);

system/uorb/sensor/co2.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,11 @@
2929
****************************************************************************/
3030

3131
#ifdef CONFIG_DEBUG_UORB
32-
static void print_sensor_co2_message(FAR const struct orb_metadata *meta,
33-
FAR const void *buffer)
34-
{
35-
FAR const struct sensor_co2 *message = buffer;
36-
const orb_abstime now = orb_absolute_time();
37-
38-
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) co2: %.2f",
39-
meta->o_name, message->timestamp, now - message->timestamp,
40-
message->co2);
41-
}
32+
static const char sensor_co2_format[] = "timestamp:%" PRIu64 ",co2:%hf";
4233
#endif
4334

4435
/****************************************************************************
4536
* Public Data
4637
****************************************************************************/
4738

48-
ORB_DEFINE(sensor_co2, struct sensor_co2, print_sensor_co2_message);
39+
ORB_DEFINE(sensor_co2, struct sensor_co2, sensor_co2_format);

system/uorb/sensor/dust.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,11 @@
2929
****************************************************************************/
3030

3131
#ifdef CONFIG_DEBUG_UORB
32-
static void print_sensor_dust_message(FAR const struct orb_metadata *meta,
33-
FAR const void *buffer)
34-
{
35-
FAR const struct sensor_dust *message = buffer;
36-
const orb_abstime now = orb_absolute_time();
37-
38-
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) dust: %.2f",
39-
meta->o_name, message->timestamp, now - message->timestamp,
40-
message->dust);
41-
}
32+
static const char sensor_dust_format[] = "timestamp:%" PRIu64 ",dust:%hf";
4233
#endif
4334

4435
/****************************************************************************
4536
* Public Data
4637
****************************************************************************/
4738

48-
ORB_DEFINE(sensor_dust, struct sensor_dust, print_sensor_dust_message);
39+
ORB_DEFINE(sensor_dust, struct sensor_dust, sensor_dust_format);

system/uorb/sensor/ecg.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,12 @@
2929
****************************************************************************/
3030

3131
#ifdef CONFIG_DEBUG_UORB
32-
static void print_sensor_ecg_message(FAR const struct orb_metadata *meta,
33-
FAR const void *buffer)
34-
{
35-
FAR const struct sensor_ecg *message = buffer;
36-
const orb_abstime now = orb_absolute_time();
37-
38-
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) ecg: %.4f "
39-
"status:0x%" PRIx32 "",
40-
meta->o_name, message->timestamp, now - message->timestamp,
41-
message->ecg, message->status);
42-
}
32+
static const char sensor_ecg_format[] =
33+
"timestamp:%" PRIu64 ",ecg:%hf,status:%" PRIx32 "";
4334
#endif
4435

4536
/****************************************************************************
4637
* Public Data
4738
****************************************************************************/
4839

49-
ORB_DEFINE(sensor_ecg, struct sensor_ecg, print_sensor_ecg_message);
40+
ORB_DEFINE(sensor_ecg, struct sensor_ecg, sensor_ecg_format);

system/uorb/sensor/force.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,12 @@
2929
****************************************************************************/
3030

3131
#ifdef CONFIG_DEBUG_UORB
32-
static void print_sensor_force_message(FAR const struct orb_metadata *meta,
33-
FAR const void *buffer)
34-
{
35-
FAR const struct sensor_force *message = buffer;
36-
const orb_abstime now = orb_absolute_time();
37-
38-
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) "
39-
"value: %.2f event: %" PRIi32 "",
40-
meta->o_name, message->timestamp, now - message->timestamp,
41-
message->force, message->event);
42-
}
32+
static const char sensor_force_format[] =
33+
"timestamp:%" PRIu64 ",force:%hf,event:%" PRIi32 "";
4334
#endif
4435

4536
/****************************************************************************
4637
* Public Data
4738
****************************************************************************/
4839

49-
ORB_DEFINE(sensor_force, struct sensor_force, print_sensor_force_message);
40+
ORB_DEFINE(sensor_force, struct sensor_force, sensor_force_format);

system/uorb/sensor/gesture.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,15 @@
2929
****************************************************************************/
3030

3131
#ifdef CONFIG_DEBUG_UORB
32-
static void
33-
print_sensor_wake_gesture_message(FAR const struct orb_metadata *meta,
34-
FAR const void *buffer)
35-
{
36-
FAR const struct sensor_wake_gesture *message = buffer;
37-
const orb_abstime now = orb_absolute_time();
38-
39-
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago)"
40-
" event: %" PRIu32 "", meta->o_name, message->timestamp,
41-
now - message->timestamp, message->event);
42-
}
32+
static const char sensor_wake_gesture_format[] =
33+
"timestamp:%" PRIu64 ",event:%" PRIu32 "";
4334
#endif
4435

4536
/****************************************************************************
4637
* Public Data
4738
****************************************************************************/
4839

4940
ORB_DEFINE(sensor_wake_gesture, struct sensor_wake_gesture,
50-
print_sensor_wake_gesture_message);
41+
sensor_wake_gesture_format);
5142
ORB_DEFINE(sensor_wake_gesture_uncal, struct sensor_wake_gesture,
52-
print_sensor_wake_gesture_message);
43+
sensor_wake_gesture_format);

system/uorb/sensor/gps.c

Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -29,54 +29,25 @@
2929
****************************************************************************/
3030

3131
#ifdef CONFIG_DEBUG_UORB
32-
static void print_sensor_gps_message(FAR const struct orb_metadata *meta,
33-
FAR const void *buffer)
34-
{
35-
FAR const struct sensor_gps *message = buffer;
36-
const orb_abstime now = orb_absolute_time();
37-
38-
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) "
39-
"time_utc: %" PRIu64 " latitude: %.4f longitude: %.4f",
40-
meta->o_name, message->timestamp, now - message->timestamp,
41-
message->time_utc, message->latitude, message->longitude);
42-
43-
uorbinfo_raw("%s:\taltitude: %.4f altitude_ellipsoid: %.4f "
44-
"ground_speed: %.4f course: %.4f",
45-
meta->o_name, message->altitude, message->altitude_ellipsoid,
46-
message->ground_speed, message->course);
47-
48-
uorbinfo_raw("%s:\teph: %.4f epv: %.4f hdop: %.4f vdop: %.4f",
49-
meta->o_name, message->eph, message->epv,
50-
message->hdop, message->vdop);
51-
}
52-
53-
static void
54-
print_sensor_gps_satellite_message(FAR const struct orb_metadata *meta,
55-
FAR const void *buffer)
56-
{
57-
FAR const struct sensor_gps_satellite *message = buffer;
58-
const orb_abstime now = orb_absolute_time();
59-
int i;
60-
61-
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago)",
62-
meta->o_name, message->timestamp, now - message->timestamp);
63-
64-
for (i = 0; i < message->count; i++)
65-
{
66-
uorbinfo_raw("%s:\tnumber:%d svid: %" PRIu32
67-
" elevation: %" PRIu32 " azimuth: %" PRIu32
68-
" snr: %" PRIu32 "",
69-
meta->o_name, i, message->info[i].svid,
70-
message->info[i].elevation, message->info[i].azimuth,
71-
message->info[i].snr);
72-
}
73-
}
32+
static const char sensor_gps_format[] =
33+
"timestamp:%" PRIu64 ",time_utc:%" PRIu64 ",latitude:%hf,longitude:%hf,"
34+
"altitude:%hf,altitude_ellipsoid:%hf,eph:%hf,epv:%hf,hdop:%hf,pdop:%hf,"
35+
"vdop:%hf,ground_speed:%hf,course:%hf,satellites_used:%" PRIu32 "";
36+
37+
static const char sensor_gps_satellite_format[] =
38+
"timestamp:%" PRIu64 ",count:%" PRIu32 ",satellites:%" PRIu32 ","
39+
"svid0:%" PRIu32 ",elevation0:%" PRIu32 ",azimuth0:%" PRIu32 ","
40+
"snr0:%" PRIu32 ",svid1:%" PRIu32 ",elevation1:%" PRIu32 ","
41+
"azimuth1:%" PRIu32 ",snr1:%" PRIu32 ",svid2:%" PRIu32 ","
42+
"elevation2:%" PRIu32 ",azimuth2:%" PRIu32 ",snr2:%" PRIu32 ","
43+
"svid3:%" PRIu32 ",elevation3:%" PRIu32 ",azimuth3:%" PRIu32 ","
44+
"snr3:%" PRIu32 "";
7445
#endif
7546

7647
/****************************************************************************
7748
* Public Data
7849
****************************************************************************/
7950

80-
ORB_DEFINE(sensor_gps, struct sensor_gps, print_sensor_gps_message);
51+
ORB_DEFINE(sensor_gps, struct sensor_gps, sensor_gps_format);
8152
ORB_DEFINE(sensor_gps_satellite, struct sensor_gps_satellite,
82-
print_sensor_gps_satellite_message);
53+
sensor_gps_satellite_format);

system/uorb/sensor/gyro.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,13 @@
2929
****************************************************************************/
3030

3131
#ifdef CONFIG_DEBUG_UORB
32-
static void print_sensor_gyro_message(FAR const struct orb_metadata *meta,
33-
FAR const void *buffer)
34-
{
35-
FAR const struct sensor_gyro *message = buffer;
36-
const orb_abstime now = orb_absolute_time();
37-
38-
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) "
39-
"temperature: %.2f x: %.2f y: %.2f z: %.2f",
40-
meta->o_name, message->timestamp, now - message->timestamp,
41-
message->temperature, message->x, message->y, message->z);
42-
}
32+
static const char sensor_gyro_format[] =
33+
"timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf";
4334
#endif
4435

4536
/****************************************************************************
4637
* Public Data
4738
****************************************************************************/
4839

49-
ORB_DEFINE(sensor_gyro, struct sensor_gyro, print_sensor_gyro_message);
50-
ORB_DEFINE(sensor_gyro_uncal, struct sensor_gyro,
51-
print_sensor_gyro_message);
40+
ORB_DEFINE(sensor_gyro, struct sensor_gyro, sensor_gyro_format);
41+
ORB_DEFINE(sensor_gyro_uncal, struct sensor_gyro, sensor_gyro_format);

0 commit comments

Comments
 (0)