Skip to content
Snippets Groups Projects
Commit 416feea9 authored by Daniel Agar's avatar Daniel Agar
Browse files

uORB print_message cleanup

 - indent field print with tabs instead of spaces
 - print a newline before printing a nested field
 - cmake add generator dependencies
parent c4c4441c
No related branches found
No related tags found
No related merge requests found
......@@ -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]@
}
\ No newline at end of file
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment