Commit Graph
4 Commits
Author SHA1 Message Date
Peter Barker c621b8fe4e AP_MSP: only send a frame which fits in the transmit buffer
The guard here contradicted the comment above it, which allows a send if
either the transmit buffer is empty or the frame fits in it. Testing
!tx_pending() instead of tx_pending() inverted that: a frame was dropped
when the buffer was empty but too small, and sent unconditionally
whenever a transmit was already pending.

Writes do not block, so sending unconditionally with insufficient space
wrote as much of the frame as would fit and discarded the rest, putting
a truncated frame on the wire. The write return values were ignored, so
the caller was told the whole frame had been sent.

The empty-buffer case exists upstream only because a blocking write
could push out a frame bigger than the buffer. ArduPilot has no blocking
writes, so require the frame to fit and drop it otherwise.
2026-08-12 17:11:32 +10:00
Andrew Tridgell 5f5c7735a3 AP_MSP: support AP_Periph MSP send 2020-09-09 06:35:50 +10:00
Andrew Tridgell f330d5aa77 AP_MSP: run new MSP code through code style script 2020-09-02 05:56:46 +10:00
yaapu 80eca32604 AP_MSP: added Multiwii Serial protocol (MSP) v1 and v2 support 2020-09-02 05:56:46 +10:00