mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
uORB print_message cleanup
- indent field print with tabs instead of spaces - print a newline before printing a nested field - cmake add generator dependencies
This commit is contained in:
parent
c4c4441c87
commit
416feea9e4
@ -165,7 +165,10 @@ add_custom_command(OUTPUT ${uorb_headers}
|
||||
-e templates/uorb
|
||||
-t ${CMAKE_CURRENT_BINARY_DIR}/tmp/headers
|
||||
-q
|
||||
DEPENDS ${msg_files} templates/uorb/msg.h.template
|
||||
DEPENDS
|
||||
${msg_files}
|
||||
templates/uorb/msg.h.template
|
||||
tools/px_generate_uorb_topic_files.py
|
||||
COMMENT "Generating uORB topic headers"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
VERBATIM
|
||||
@ -182,7 +185,10 @@ add_custom_command(OUTPUT ${uorb_sources}
|
||||
-e templates/uorb
|
||||
-t ${CMAKE_CURRENT_BINARY_DIR}/tmp/sources
|
||||
-q
|
||||
DEPENDS ${msg_files} templates/uorb/msg.cpp.template
|
||||
DEPENDS
|
||||
${msg_files}
|
||||
templates/uorb/msg.cpp.template
|
||||
tools/px_generate_uorb_topic_files.py
|
||||
COMMENT "Generating uORB topic sources"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
VERBATIM
|
||||
|
||||
@ -80,9 +80,14 @@ ORB_DEFINE(@multi_topic, struct @uorb_struct, @(struct_size-padding_end_size), _
|
||||
|
||||
void print_message(const @uorb_struct& message)
|
||||
{
|
||||
printf(" @(uorb_struct)\n");
|
||||
printf("\ttimestamp: %" PRIu64 " (%.6f seconds ago)\n", message.timestamp, hrt_elapsed_time(&message.timestamp) / 1e6);
|
||||
printf(" @(uorb_struct)\n");
|
||||
printf("\ttimestamp: %" PRIu64, message.timestamp);
|
||||
if (message.timestamp != 0) {
|
||||
printf(" (%.6f seconds ago)\n", hrt_elapsed_time(&message.timestamp) / 1e6);
|
||||
} else {
|
||||
printf("\n");
|
||||
}
|
||||
@[for field in sorted_fields]@
|
||||
@( print_field(field) )
|
||||
@[end for]
|
||||
@( print_field(field) )@
|
||||
@[end for]@
|
||||
}
|
||||
@ -205,7 +205,7 @@ def print_field(field):
|
||||
|
||||
else:
|
||||
for i in range(array_length):
|
||||
print("printf(\" " + field.type + " " + field.name + "[" + str(i) + "]\");")
|
||||
print("printf(\"\\t" + field.type + " " + field.name + "[" + str(i) + "]\");")
|
||||
print(" print_message(message." + field.name + "[" + str(i) + "]);")
|
||||
return
|
||||
|
||||
@ -236,11 +236,11 @@ def print_field(field):
|
||||
field_name = "(double)" + field_name
|
||||
|
||||
else:
|
||||
print("printf(\" " + field.name + "\");")
|
||||
print("printf(\"\\n\\t" + field.name + "\");")
|
||||
print("\tprint_message(message."+ field.name + ");")
|
||||
return
|
||||
|
||||
print("printf(\"\t" + field.name + ": " + c_type + "\\n\", " + field_name + ");" )
|
||||
print("printf(\"\\t" + field.name + ": " + c_type + "\\n\", " + field_name + ");" )
|
||||
|
||||
|
||||
def print_field_def(field):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user