Skip to content

Commit

Permalink
lib: Fix sequence order
Browse files Browse the repository at this point in the history
As described on the documentation:
0 - magic
1 - len
2 - seq
3 - sysid
4 - compid

Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Nov 21, 2023
1 parent bb5ccef commit 00925fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ impl<M: Message> MavFrame<M> {
let mut v = vec![];

// serialize header
v.push(self.header.sequence);
v.push(self.header.system_id);
v.push(self.header.component_id);
v.push(self.header.sequence);

// message id
match self.protocol_version {
Expand All @@ -170,9 +170,9 @@ impl<M: Message> MavFrame<M> {
pub fn deser(version: MavlinkVersion, input: &[u8]) -> Result<Self, ParserError> {
let mut buf = BytesMut::from(input);

let sequence = buf.get_u8();
let system_id = buf.get_u8();
let component_id = buf.get_u8();
let sequence = buf.get_u8();
let header = MavHeader {
system_id,
component_id,
Expand Down

0 comments on commit 00925fb

Please sign in to comment.