Commit f94531e8 authored by Lorenz Meier's avatar Lorenz Meier

Logging in a more compact, more reasonable file format

parent 09851680
...@@ -291,12 +291,11 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) ...@@ -291,12 +291,11 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
// Log data // Log data
if (m_loggingEnabled && m_logfile) if (m_loggingEnabled && m_logfile)
{ {
const int len = MAVLINK_MAX_PACKET_LEN+sizeof(quint64); uint8_t buf[MAVLINK_MAX_PACKET_LEN+sizeof(quint64)];
uint8_t buf[len];
quint64 time = QGC::groundTimeUsecs(); quint64 time = QGC::groundTimeUsecs();
memcpy(buf, (void*)&time, sizeof(quint64)); memcpy(buf, (void*)&time, sizeof(quint64));
// Write message to buffer // 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); QByteArray b((const char*)buf, len);
if(m_logfile->write(b) < static_cast<qint64>(MAVLINK_MAX_PACKET_LEN+sizeof(quint64))) if(m_logfile->write(b) < static_cast<qint64>(MAVLINK_MAX_PACKET_LEN+sizeof(quint64)))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment