mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 04:33:10 +08:00
reformat how the passed time is printed
This commit is contained in:
@@ -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]@
|
||||
|
||||
}
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user