Skip to content

Commit

Permalink
Added fix for python generator for float arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoppert committed Sep 20, 2013
1 parent 0fd1274 commit a695e2f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pymavlink/generator/mavgen_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,12 @@ def __init__(self""" % (m.name.lower(), wrapper.fill(m.description.strip())))
outf.write("""
def pack(self, mav):
return MAVLink_message.pack(self, mav, %u, struct.pack('%s'""" % (m.crc_extra, m.fmtstr))
if len(m.fields) != 0:
outf.write(", self." + ", self.".join(m.ordered_fieldnames))
for field in m.ordered_fields:
if (field.type == "float" and field.array_length > 1):
for i in range(field.array_length):
outf.write(", self.{0:s}[{1:d}]".format(field.name,i))
else:
outf.write(", self.{0:s}".format(field.name))
outf.write("))\n")


Expand Down

0 comments on commit a695e2f

Please sign in to comment.