From f94531e82d1650cd63f412172398bd089bf5b876 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 13 Sep 2012 18:12:26 +0200 Subject: [PATCH] Logging in a more compact, more reasonable file format --- src/comm/MAVLinkProtocol.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc index 12acc51a0..4c410f4e7 100644 --- a/src/comm/MAVLinkProtocol.cc +++ b/src/comm/MAVLinkProtocol.cc @@ -291,12 +291,11 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) // Log data if (m_loggingEnabled && m_logfile) { - const int len = MAVLINK_MAX_PACKET_LEN+sizeof(quint64); - uint8_t buf[len]; + uint8_t buf[MAVLINK_MAX_PACKET_LEN+sizeof(quint64)]; quint64 time = QGC::groundTimeUsecs(); memcpy(buf, (void*)&time, sizeof(quint64)); // Write message to buffer - mavlink_msg_to_send_buffer(buf+sizeof(quint64), &message); + int len = mavlink_msg_to_send_buffer(buf+sizeof(quint64), &message); QByteArray b((const char*)buf, len); if(m_logfile->write(b) < static_cast(MAVLINK_MAX_PACKET_LEN+sizeof(quint64))) { -- 2.22.0