mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 03:49:12 +08:00
msg: timestamp_sample print elapsed from timestamp
This commit is contained in:
@@ -89,6 +89,9 @@ void print_message(const @uorb_struct &message)
|
|||||||
PX4_INFO_RAW("Not implemented on flash constrained hardware\n");
|
PX4_INFO_RAW("Not implemented on flash constrained hardware\n");
|
||||||
@[else]
|
@[else]
|
||||||
PX4_INFO_RAW(" @(uorb_struct)\n");
|
PX4_INFO_RAW(" @(uorb_struct)\n");
|
||||||
|
|
||||||
|
const hrt_abstime now = hrt_absolute_time();
|
||||||
|
|
||||||
@[for field in sorted_fields]@
|
@[for field in sorted_fields]@
|
||||||
@( print_field(field) )@
|
@( print_field(field) )@
|
||||||
@[end for]@
|
@[end for]@
|
||||||
|
|||||||
@@ -298,7 +298,9 @@ def print_field(field):
|
|||||||
if field.name == 'timestamp':
|
if field.name == 'timestamp':
|
||||||
print(("if (message.timestamp != 0) {\n\t\tPX4_INFO_RAW(\"\\t" + field.name +
|
print(("if (message.timestamp != 0) {\n\t\tPX4_INFO_RAW(\"\\t" + field.name +
|
||||||
": " + c_type + " (%.6f seconds ago)\\n\", " + 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}"))
|
", (now - message.timestamp) / 1e6);\n\t} else {\n\t\tPX4_INFO_RAW(\"\\n\");\n\t}"))
|
||||||
|
elif field.name == 'timestamp_sample':
|
||||||
|
print(("\n\tPX4_INFO_RAW(\"\\t" + field.name + ": " + c_type + " (" + c_type + " us before timestamp)\\n\", " + field_name + ", message.timestamp - message.timestamp_sample);\n\t"))
|
||||||
elif field.name == 'device_id':
|
elif field.name == 'device_id':
|
||||||
print("char device_id_buffer[80];")
|
print("char device_id_buffer[80];")
|
||||||
print("device::Device::device_id_print_buffer(device_id_buffer, sizeof(device_id_buffer), message.device_id);")
|
print("device::Device::device_id_print_buffer(device_id_buffer, sizeof(device_id_buffer), message.device_id);")
|
||||||
|
|||||||
Reference in New Issue
Block a user