AP_MSP: don't send zero length MSP packets

This commit is contained in:
Andrew Tridgell 2020-08-31 12:54:29 +10:00
parent f033aaf5bd
commit c31bab2a85

View File

@ -140,8 +140,12 @@ void AP_MSP_Telem_Backend::process_packet(uint8_t idx)
uint8_t *out_buf_head = reply.buf.ptr;
msp_process_out_command(msp_packet_type_map[idx], &reply.buf);
uint32_t len = reply.buf.ptr - &out_buf[0];
sbuf_switch_to_reader(&reply.buf, out_buf_head); // change streambuf direction
msp_serial_encode(&_msp_port, &reply, _msp_port.msp_version);
if (len > 0) {
// don't send zero length packets
msp_serial_encode(&_msp_port, &reply, _msp_port.msp_version);
}
_msp_port.c_state = MSP_IDLE;
}