I am working on creating some smaller versions of mavlink messages that I send between my px4 to a homebrew iOS ground station and running into an issue that I'd love some pointers on. I can send new custom messages from the ground station to the px4 just fine, but am unable to send new messages from the px4 to the ground station.
I have dug into it as much as possible and can see that the new messages are being sent from the px4 and received by the ground station, but there is an issue with the CRC1 check. In the "case MAVLINK_PARSE_STATE_GOT_CRC1" conditional of the mavlink_parse_char method of mavlink_helpers.c, if I log c, and rxmsg->checksum>>8 for the new message, the rxmsg->checksum>>8 is always off by two in either the positive or negative direction from c. If I disable the checking of the checksum, the payload of the message appears to be correct. The value of the CRC in MAVLINK_MESSAGE_CRCS array is consistent with the value defined in mavlink_msg_xx.h file.
I am generating the new messages by modifying common.xml and using mavgenerate.py GUI to create the c files for both the px4 and objective-c code.
Any ideas what I might be doing wrong? I have attached the modified common.xml and the generated files if anyone is interested in digging in. In this case, I am testing a modified version of the ATTITUDE message, in which I've removed the yawspeed field. I have also tried modified versions of other messages and the results appear to be the same. The MANUAL_CONTROL_S messages in which I've switched to 8 bit ints and removed the button bit field, which is working as expected when sending from ground station to px4, is also included in this.
This may be a red herring, but the mavlink_helpers.h file does not compile correctly after being generated, as it is missing a definition for MAVLINK_STX. I have no idea what this variable does, but if I copy the MAVLINK_STX definition from mavlink.h, then the code compiles and I can send and receive any non-custom messages.
I've been completely blocked on this for over a week now, so I'd be extremely grateful for any help!
Thanks,
Tobin