Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FYI XML to support exponentiation #11

Closed
hamishwillee opened this issue Feb 15, 2024 · 5 comments
Closed

FYI XML to support exponentiation #11

hamishwillee opened this issue Feb 15, 2024 · 5 comments

Comments

@hamishwillee
Copy link

FYI We're modifying the MAVLink XSD validation file in ArduPilot/pymavlink#920 to allow a bitmask value to be declared using the Python exponentiation operator.

This makes it easier to immediately visualize which bit is set by a flag, because you can use the syntax

<entry value="2**15" name="BIT15" />

rather than

<entry value="32768" name=" BIT15" />

This is transparent to mavgen because the parser evaluates the number before creating the generated headers. However it may affect other the rust parser
We're not updating the XML yet to allow other parsers time to update.

Any concerns, please raise on ArduPilot/pymavlink#920

@olliw42
Copy link
Owner

olliw42 commented Feb 15, 2024

MANY THX for informing me, this is really much appreciated.

I too would have preferred the more common '^' over '**', but I think it's anyway a very good addition, making things easier. Very cool.

@olliw42
Copy link
Owner

olliw42 commented Feb 15, 2024

@hamishwillee

I've looked into the code and also tested it:

  • like for mavgen 'value' is also passed through eval, and 2**x comes out correctly.
  • for 'default' it seems neither mavgen nor fastmavlink really make use of the value.

It seems to me that fastmavlink is ready for exponentiation.
Thx again for bringing this up.

@hamishwillee
Copy link
Author

Excellent

FWIW for 'default' it seems neither mavgen nor fastmavlink really make use of the value - yeah, its supposed to be a better form of documentation and might be used by a programming language that supports taking default values. No one has done that though.

@olliw42
Copy link
Owner

olliw42 commented Feb 16, 2024

I'm looking forward for this new xsd to be merged :)

@hamishwillee
Copy link
Author

Me too. No merge rights in that repo

@olliw42 olliw42 closed this as completed Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants