diff --git a/generator/mavgen_javascript.py b/generator/mavgen_javascript.py index e99bd3604..56deb9e17 100644 --- a/generator/mavgen_javascript.py +++ b/generator/mavgen_javascript.py @@ -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: @@ -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;