Skip to content

Commit

Permalink
Merge pull request #1752 from alehed/fix/make_compatible_with_mavlink…
Browse files Browse the repository at this point in the history
…_pr_666

Make compatible with pymavlink type annotations PR
  • Loading branch information
vooon committed Jun 7, 2022
2 parents fce4ce0 + 686c531 commit 9430c4e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mavros/mavros/cmd/checkid.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,15 @@ def fmt_msgid(msgid: int) -> str:
if msg is None:
return f"{msgid}"
else:
return f"{msgid} ({msg.name})"
msg_name = ""
# In version 2.4.30 <TODO: replace with actual number>, the class variable name
# was renamed to msgname. Since we don't know the pymavlink version we need to check
# for both.
if hasattr(msg, "msgname"):
msg_name = msg.msgname
else:
msg_name = msg.name
return f"{msgid} ({msg_name})"

str_ids = self.fmt_ids(address)
click.secho(
Expand Down

0 comments on commit 9430c4e

Please sign in to comment.