Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: async serial #284

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

feat: async serial #284

wants to merge 2 commits into from

Conversation

roby2014
Copy link

Tried following the other connection wrappers structures.
Needs testing (i'll test soon).

@roby2014
Copy link
Author

Did a simple test with serial:/dev/ttyACM1:115200:

// ...
        let mut connection =
            mavlink::connect_async::<mavlink::ardupilotmega::MavMessage>("serial:/dev/ttyACM1:115200").await?;
        connection.set_protocol_version(self.mavlink_version);
// ...
            select! {
                res = connection.recv() => {
                    match res {
                        Ok((header, msg)) => {
                            trace!(?header, ?msg, "received message from connection");
                            //...
                        }
                        Err(e) => {
                            error!("failed to read: {e}");
                        }
                    }
                }
                res = channel.recv() => {
                    // ...
                }
            }

and I'm able to get data:

received message from connection header=MavHeader { system_id: 1, component_id: 1, sequence: 133 } msg=ATTITUDE(ATTITUDE_DATA { time_boot_ms: 389342, roll: 0.0, pitch: 0.0, yaw: 0.0, rollspeed: 0.0, pitchspeed: 0.0, yawspeed: 0.0 })

received message from connection header=MavHeader { system_id: 1, component_id: 1, sequence: 134 } msg=VFR_HUD(VFR_HUD_DATA { airspeed: 0.0, groundspeed: 0.0, alt: 0.0, climb: 0.0, heading: 0, throttle: 0 })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants