Browse Source

Logging in a more compact, more reasonable file format

QGC4.4
Lorenz Meier 13 years ago
parent
commit
f94531e82d
  1. 5
      src/comm/MAVLinkProtocol.cc

5
src/comm/MAVLinkProtocol.cc

@ -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)))
{ {

Loading…
Cancel
Save