Skip to content

Commit

Permalink
Heartbeat mavlink version should be auto-set
Browse files Browse the repository at this point in the history
  • Loading branch information
shancock884 committed Feb 28, 2024
1 parent c54a9ed commit e2107ba
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions generator/mavgen_javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,13 @@ def field_descriptions(fields):

# assemble some strings we'll use later in outputting ..
comment = " * %s (%d)\n * \n%s\n * \n%s" % (m.name, m.id, wrapper.fill(m.description.strip()), field_descriptions(m.fields))
selffieldnames = 'self, '
argfieldnames = []
conststr = ""
for f in m.fields:
selffieldnames += '%s, ' % f.name
selffieldnames = selffieldnames[:-2]
if not f.omit_arg:
argfieldnames.append(f.name)
else:
conststr = conststr + " this.%s = %s;\n" % (f.name, f.const_value)

# instance field support copied from mavgen_python
if m.instance_field is not None:
Expand All @@ -290,11 +293,11 @@ def field_descriptions(fields):
outf.write("%s.messages.%s = function(" % ( get_mavhead(xml), m.name.lower() ) )
outf.write(" ...moreargs ) {\n")
# passing the dynamic args into the correct attributes, we can call the constructor with or without the 'moreargs'
outf.write(" [ this.%s ] = moreargs;\n" % " , this.".join(m.fieldnames))
outf.write(" [ this.%s ] = moreargs;\n" % " , this.".join(argfieldnames))
outf.write(conststr)

# body: set message type properties
outf.write("""
this._format = '%s';
this._id = %s.MAVLINK_MSG_ID_%s;
this.order_map = %s;
Expand Down

0 comments on commit e2107ba

Please sign in to comment.