Skip to content

Commit

Permalink
comment pack and include array length
Browse files Browse the repository at this point in the history
  • Loading branch information
shancock884 committed Feb 28, 2024
1 parent 13b19f3 commit c54a9ed
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions generator/mavgen_javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,12 @@ def generate_classes(outf, msgs, xml):
def field_descriptions(fields):
ret = ""
for f in fields:
ret += " * @param %s %s (%s)\n" % (f.name, f.description.strip(), f.type)
if f.array_length:
arraystr = "[%d]" % f.array_length
else:
arraystr = ""
if not f.omit_arg:
ret += " * @param %s %s (%s%s)\n" % (f.name, f.description.strip(), f.type, arraystr)
return ret

# now do all the messages
Expand Down Expand Up @@ -321,12 +326,13 @@ def field_descriptions(fields):
outf.write("\n}\n")

# inherit methods from the base message class
outf.write("\n%s.messages.%s.prototype = new %s.message;\n" % ( get_mavhead(xml), m.name.lower() ,get_mavhead(xml) ) )
outf.write("%s.messages.%s.prototype = new %s.message;\n\n" % ( get_mavhead(xml), m.name.lower() ,get_mavhead(xml) ) )

orderedfields = "var orderedfields = [ this." + ", this.".join(m.ordered_fieldnames) + "];";


# Implement the pack() function for this message
t.write(outf,"/** Pack the ${MNAME} message */\n" % m.name);
t.write(outf, """
${MAVHEAD}.messages.${MNAME}.prototype.pack = function(mav) {
${MORDERED}
Expand Down

0 comments on commit c54a9ed

Please sign in to comment.