Skip to content

Commit

Permalink
uORB generation use constexpr (#7348)
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed Jun 3, 2017
1 parent 96cffd4 commit b4e2360
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion msg/templates/uorb/msg.cpp.template
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ topic_fields = ["uint64_t timestamp"]+["%s %s" % (convert_type(field.type), fiel

@# join all msg files in one line e.g: "float[3] position;float[3] velocity;bool armed"
@# This is used for the logger
const char *__orb_@(topic_name)_fields = "@( ";".join(topic_fields) );";
constexpr char __orb_@(topic_name)_fields[] = "@( ";".join(topic_fields) );";

@[for multi_topic in topics]@
ORB_DEFINE(@multi_topic, struct @uorb_struct, @(struct_size-padding_end_size),
Expand Down
2 changes: 1 addition & 1 deletion msg/templates/uorb/msg.h.template
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ for constant in spec.constants:
else:
raise Exception("Type {0} not supported, add to to template file!".format(type_name))

print('\tstatic const %s %s = %s;'%(type_px4, constant.name, int(constant.val)))
print('\tstatic constexpr %s %s = %s;'%(type_px4, constant.name, int(constant.val)))
}
#endif
};
Expand Down

0 comments on commit b4e2360

Please sign in to comment.