mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 23:23:33 +08:00
add timestamp field to uORB msgs; sync timestamp whenever possible
This commit is contained in:
@@ -61,7 +61,7 @@ topic_name = spec.short_name
|
||||
|
||||
sorted_fields = sorted(spec.parsed_fields(), key=sizeof_field_type, reverse=True)
|
||||
struct_size, padding_end_size = add_padding_bytes(sorted_fields, search_path)
|
||||
topic_fields = ["uint64_t timestamp"]+["%s %s" % (convert_type(field.type), field.name) for field in sorted_fields]
|
||||
topic_fields = ["%s %s" % (convert_type(field.type), field.name) for field in sorted_fields]
|
||||
}@
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
@@ -110,8 +110,6 @@ struct __EXPORT @(uorb_struct) {
|
||||
#else
|
||||
struct @(uorb_struct) {
|
||||
#endif
|
||||
@# timestamp at the beginning of each topic is required for logger
|
||||
uint64_t timestamp; // required for logger
|
||||
@print_parsed_fields()
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -147,7 +147,6 @@ void serialize_@(topic_name)(MicroBuffer *microCDRWriter, const struct @(uorb_st
|
||||
|
||||
reset_micro_buffer(microCDRWriter);
|
||||
|
||||
serialize_uint64_t(microCDRWriter, input->timestamp);
|
||||
@add_code_to_serialize()
|
||||
(*length) = micro_buffer_length(microCDRWriter);
|
||||
}
|
||||
@@ -159,6 +158,5 @@ void deserialize_@(topic_name)(MicroBuffer *microCDRReader, struct @(uorb_struct
|
||||
|
||||
reset_micro_buffer(microCDRReader);
|
||||
|
||||
deserialize_uint64_t(microCDRReader, &output->timestamp);
|
||||
@add_code_to_deserialize()
|
||||
}
|
||||
|
||||
@@ -65,11 +65,10 @@ def add_msg_fields():
|
||||
for field in sorted_fields:
|
||||
add_msg_field(field)
|
||||
|
||||
|
||||
|
||||
}@
|
||||
@
|
||||
struct @(spec.short_name)_
|
||||
{
|
||||
unsigned long long timestamp;
|
||||
@add_msg_fields()
|
||||
}; // struct @(spec.short_name)_
|
||||
|
||||
Reference in New Issue
Block a user