reformat how the passed time is printed

This commit is contained in:
TSC21
2018-08-08 15:11:52 +01:00
committed by Beat Küng
parent cac84e1424
commit a1ac34d3e7
2 changed files with 7 additions and 6 deletions
+1 -5
View File
@@ -81,12 +81,8 @@ ORB_DEFINE(@multi_topic, struct @uorb_struct, @(struct_size-padding_end_size), _
void print_message(const @uorb_struct& message)
{
PX4_INFO_RAW(" @(uorb_struct)\n");
if (message.timestamp != 0) {
PX4_INFO_RAW("\t(%.6f seconds ago)\n", hrt_elapsed_time(&message.timestamp) / 1e6);
} else {
PX4_INFO_RAW("\n");
}
@[for field in sorted_fields]@
@( print_field(field) )@
@[end for]@
}
+6 -1
View File
@@ -246,7 +246,12 @@ def print_field(field):
print("\tprint_message(message."+ field.name + ");")
return
print("PX4_INFO_RAW(\"\\t" + field.name + ": " + c_type + "\\n\", " + field_name + ");" )
if field.name == 'timestamp':
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\tprintf(\"\\n\");\n\t}" )
else:
print("PX4_INFO_RAW(\"\\t" + field.name + ": " + c_type + "\\n\", " + field_name + ");" )
def print_field_def(field):