I mean if I know the ID of the message I also know it's size, so why use both in the header?
You need to be a member of diydrones to add comments!
I mean if I know the ID of the message I also know it's size, so why use both in the header?
You need to be a member of diydrones to add comments!
Replies
Thank you both guys for your replies! They were both very helpful especially Andre K. 's(to properly ignore correct bytes after a unknown message). I hadn't even thought about that...
This is solved for me...
most likely to properly ignore correct bytes after a unknown message.
this way it is backward compatible, a mavlink system, like a GCS , will work correctly even if your onboard payload injects non-standard messages.
Can you clarify if the message size is strictly the message id? If it is not than many reasons come to my mind to why the there are both.
Imagine that 2 systems are using the same message type but for some reason have different sizes due to being compiled with incompatible headers. It would cause data corruption in the best case, and maybe even a buffer overflow in the worse depending on the implementation.