mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 23:53:33 +08:00
uORB print_message add device_id pretty print
This commit is contained in:
committed by
Lorenz Meier
parent
7cc0e69fcd
commit
af6098b9ea
@@ -69,6 +69,7 @@ topic_fields = ["%s %s" % (convert_type(field.type), field.name) for field in so
|
||||
#include <px4_defines.h>
|
||||
#include <uORB/topics/@(topic_name).h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <lib/drivers/device/Device.hpp>
|
||||
|
||||
@# join all msg files in one line e.g: "float[3] position;float[3] velocity;bool armed"
|
||||
@# This is used for the logger
|
||||
|
||||
@@ -250,6 +250,10 @@ def print_field(field):
|
||||
print("if (message.timestamp != 0) {\n\t\tPX4_INFO_RAW(\"\\t" + field.name + \
|
||||
": " + c_type + " (%.6f seconds ago)\\n\", " + field_name + \
|
||||
", hrt_elapsed_time(&message.timestamp) / 1e6);\n\t} else {\n\t\tPX4_INFO_RAW(\"\\n\");\n\t}" )
|
||||
elif field.name == 'device_id':
|
||||
print("char device_id_buffer[80];")
|
||||
print("device::Device::device_id_print_buffer(device_id_buffer, sizeof(device_id_buffer), message.device_id);")
|
||||
print("PX4_INFO_RAW(\"\\tdevice_id: %d (%s) \\n\", message.device_id, device_id_buffer);" )
|
||||
else:
|
||||
print("PX4_INFO_RAW(\"\\t" + field.name + ": " + c_type + "\\n\", " + field_name + ");" )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user