pub struct MspClient { /* private fields */ }Expand description
ctx.msp — read and write raw MSP to a Betaflight / iNav / KISS FC through
the host’s MSP byte plane. The sibling of MavlinkClient for an FC that
speaks MSP; the codec that builds/parses the bytes is
ados_protocol::msp.
Implementations§
Source§impl MspClient
impl MspClient
Sourcepub async fn send(&self, msg_bytes: &[u8]) -> Result<Value, ClientError>
pub async fn send(&self, msg_bytes: &[u8]) -> Result<Value, ClientError>
Send already-framed MSP bytes (build them with ados_protocol::msp).
Gated on msp.write.
Sourcepub async fn send_raw_rc(&self, channels: &[u16]) -> Result<Value, ClientError>
pub async fn send_raw_rc(&self, channels: &[u16]) -> Result<Value, ClientError>
Convenience: send an MSP_SET_RAW_RC with the given PWM channel values
(v2 framing). Builds the frame with the codec and sends it. Returns an
error if a v1 encode were requested with too many channels (v2 never
overflows). This is the command that flies the FC in a rate mode.
Sourcepub async fn send_sticks(
&self,
roll: f32,
pitch: f32,
yaw: f32,
throttle: f32,
) -> Result<Value, ClientError>
pub async fn send_sticks( &self, roll: f32, pitch: f32, yaw: f32, throttle: f32, ) -> Result<Value, ClientError>
Send an MSP_SET_RAW_RC from NORMALIZED stick inputs, applying the codec’s
stick scaling. roll/pitch/yaw are bipolar -1.0..=1.0 (centre 0 →
1500 µs); throttle is 0.0..=1.0 (idle 0 → 1000 µs, NOT centre).
Channels are packed AETR [roll, pitch, throttle, yaw], the codebase
convention (the ados-crsf bank + the GCS mapping).
This is the safe way to fly an MSP FC from a control loop: send_raw_rc
takes RAW PWM and applies NO scaling, so handing it normalized sticks
sends near-centre garbage (and a 0.0 throttle would sit at 0, not
idle). Prefer this whenever the loop produces normalized commands.
Sourcepub async fn subscribe(
&self,
callback: EventCallback,
) -> Result<(), ClientError>
pub async fn subscribe( &self, callback: EventCallback, ) -> Result<(), ClientError>
Subscribe to the raw FC->host MSP byte stream. The callback fires for each
delivered chunk with the {bytes, timestamp_ms} map; the plugin’s own
codec parses bytes. Gated on msp.read.