mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 08:40:30 +08:00
fix(mavlink): fit a full-size signed frame in the send buffer (#29164)
send_bytes() rejected a chunk when it filled the buffer exactly. The
buffer is MAVLINK_MAX_PACKET_LEN (280) bytes, which is the size of a
signed frame with a 255-byte payload, so the last chunk of such a frame
(its signature) was dropped while the rest was sent with the signed
flag set. With signing enabled every LOGGING_DATA frame of the MAVLink
log streaming was unparsable and the receiver also lost the following
frame.
(cherry picked from commit 0a33696cb9)
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
1 parent
9d8cfcfc91
commit
8f3a392f4d
1 file changed
+2
-1
@@ -1000,7 +1000,8 @@ void Mavlink::send_finish()
|
||||
void Mavlink::send_bytes(const uint8_t *buf, unsigned packet_len)
|
||||
{
|
||||
if (!_tx_buffer_low) {
|
||||
if (_buf_fill + packet_len < sizeof(_buf)) {
|
||||
// _buf holds exactly one maximum-length frame (280 bytes for a signed frame with a 255-byte payload)
|
||||
if (_buf_fill + packet_len <= sizeof(_buf)) {
|
||||
memcpy(&_buf[_buf_fill], buf, packet_len);
|
||||
_buf_fill += packet_len;
|
||||
|
||||
|
||||
Reference in new issue
Block a user