Skip to content

Commit 2d6d875

Browse files
joaoantoniocardosopatrickelectric
authored andcommitted
src: lib: Parse messages using the message's protocol, not the preferred protocol
1 parent ad1cd65 commit 2d6d875

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/lib/protocol.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,9 @@ impl Protocol {
6565
{
6666
let mut reader = mavlink::async_peek_reader::AsyncPeekReader::new(self.as_slice());
6767

68-
match cli::mavlink_version() {
69-
1 => mavlink::read_v1_msg_async::<M, _>(&mut reader).await,
70-
2 => mavlink::read_v2_msg_async::<M, _>(&mut reader).await,
71-
_ => unreachable!(),
72-
}
73-
.map_err(anyhow::Error::msg)
68+
mavlink::read_any_msg_async(&mut reader)
69+
.await
70+
.map_err(anyhow::Error::msg)
7471
}
7572

7673
pub async fn to_mavlink_json<M>(&self) -> Result<MAVLinkJSON<M>>

0 commit comments

Comments
 (0)