Skip to content

Commit

Permalink
Mavgen WLua: Add param units to display
Browse files Browse the repository at this point in the history
  • Loading branch information
shancock884 committed Sep 10, 2023
1 parent b1e16d1 commit e94d328
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions generator/mavgen_wlua.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,11 @@ def generate_field_or_param(outf, field_or_param, name, label, physical_type, fi
field_type = "ftypes.UINT32"
else:
display_type = physical_type
unitstr = " " + field_or_param.units if field_or_param.units else ""
t.write(outf,
"""
f.${fname} = ProtoField.new("${flabel} (${ftypename})", "mavlink_proto.${fname}", ${ftype}, ${fvalues})
""", {'fname': name, 'flabel': label, 'ftypename': display_type, 'ftype': field_type, 'fvalues': values})
f.${fname} = ProtoField.new("${flabel} (${ftypename})${unitname}", "mavlink_proto.${fname}", ${ftype}, ${fvalues})
""", {'fname': name, 'flabel': label, 'ftypename': display_type, 'ftype': field_type, 'fvalues': values, 'unitname': unitstr})

# generate flag enum subfields
if enum_obj and enum_obj.bitmask:
Expand Down

0 comments on commit e94d328

Please sign in to comment.