From 0ad17a61353ab3733a2675974ec6553e7ed2efe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Tue, 21 Nov 2023 13:27:21 -0300 Subject: [PATCH] lib: Fix message_id size from 32 to 24 bits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index bfc763b7e2..6aabb3d6bf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -153,7 +153,7 @@ impl MavFrame { 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 @@ -180,7 +180,7 @@ impl MavFrame { }; 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, };