mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 13:13:34 +08:00
IDL generation: add constants fields for IDL's
This commit is contained in:
@@ -83,6 +83,15 @@ def add_msg_fields():
|
||||
key=sizeof_field_type, reverse=True)
|
||||
for field in sorted_fields:
|
||||
add_msg_field(field)
|
||||
|
||||
|
||||
def add_msg_constants():
|
||||
sorted_constants = sorted(spec.constants,
|
||||
key=sizeof_field_type, reverse=True)
|
||||
for constant in sorted_constants:
|
||||
constant_value = '%d' % constant.val
|
||||
print("const " + get_idl_type_name(constant.type) + " " + constant.name + " = " + constant_value + ";")
|
||||
|
||||
}@
|
||||
#ifndef __@(spec.short_name)__idl__
|
||||
#define __@(spec.short_name)__idl__
|
||||
@@ -94,6 +103,9 @@ def add_msg_fields():
|
||||
@(line)
|
||||
@[end for]@
|
||||
|
||||
@# Constants
|
||||
@add_msg_constants()
|
||||
|
||||
@[for type in builtin_types]@
|
||||
typedef @(type + '_') @(type);
|
||||
@[end for]@
|
||||
|
||||
Reference in New Issue
Block a user