1

I'm trying to understand the source code of ArduPlane. The MAVLink message is decoded using a set of _MAV_RETURN_???? functions, e.g. _MAV_RETURN_float

When I grep recursively for _MAV_RETURN_float, I could not find where it is defined. I wonder if I'm missing anything.


UPDATE
Here is the source code of Ardupilot, including ArduPlane.
https://github.com/diydrones/ardupilot

sean
  • 63
  • 7
  • they look like macros and not functions. take a look into the header file (.h or .hpp). Anyway, since not everybody has ArduPlane installed it should be nice if you points us to the repository on GitHub if present (as I started it was there) – Wilhelm Jan 01 '15 at 09:16
  • @Dave thanks for your reply, I updated the repository of the source code. I grepped recursively for all files in all sub-folders, and I could only see places it is called. – sean Jan 02 '15 at 20:13
  • You are right. I've downloaded the whole repositiry and searched with grep thru all files. I get only return functions, but not the macro. I saw in internet but nothing. I think you should ask in the diydrones forum. Sorry! – Wilhelm Jan 02 '15 at 22:47
  • @Dave I already asked in the APM forum, and nobody has replied me yet. Thanks anyway. – sean Jan 04 '15 at 04:20

1 Answers1

1

Macros(_MAV_RETURN_??) for uin8_t, int8_t and char are defined at https://github.com/diydrones/ardupilot/blob/master/libraries/GCS_MAVLink/include/mavlink/v1.0/protocol.h#L236 onwoards.

However for datatype with more that 8 bits, they have written inline function _MAV_RETURN_## using 'Token Pasting Operator' which handles rest 16bit, 32bit and 64bit datatypes handled by mavlink including float. This function is written at https://github.com/diydrones/ardupilot/blob/master/libraries/GCS_MAVLink/include/mavlink/v1.0/protocol.h#L242 onwards

You an read more about Token Pasting Operator (##) in following links https://stackoverflow.com/questions/216875/in-macros https://gcc.gnu.org/onlinedocs/cpp/Concatenation.html#Concatenation

nikhil
  • 633
  • 4
  • 8