Skip to content

Commit

Permalink
lib: Fix message_id size from 32 to 24 bits
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
  • Loading branch information
patrickelectric committed Nov 21, 2023
1 parent 1fcb519 commit c4d2c0c
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 @@ -153,7 +153,7 @@ impl<M: Message> MavFrame<M> {
match self.protocol_version {
MavlinkVersion::V2 => {
let bytes: [u8; 4] = self.msg.message_id().to_le_bytes();
v.extend_from_slice(&bytes);
v.extend_from_slice(&bytes[..3]);
}
MavlinkVersion::V1 => {
v.push(self.msg.message_id() as u8); //TODO check
Expand All @@ -180,7 +180,7 @@ impl<M: Message> MavFrame<M> {
};

let msg_id = match version {
MavlinkVersion::V2 => buf.get_u32_le(),
MavlinkVersion::V2 => buf.get_int_le(3) as u32,
MavlinkVersion::V1 => buf.get_u8() as u32,
};

Expand Down

0 comments on commit c4d2c0c

Please sign in to comment.