QGXPX4UAS.cc 1.15 KB
Newer Older
1 2
#include "QGXPX4UAS.h"

3 4
QGXPX4UAS::QGXPX4UAS(MAVLinkProtocol* mavlink, int id) :
    UAS(mavlink, id)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
{
}

/**
 * This function is called by MAVLink once a complete, uncorrupted (CRC check valid)
 * mavlink packet is received.
 *
 * @param link Hardware link the message came from (e.g. /dev/ttyUSB0 or UDP port).
 *             messages can be sent back to the system via this link
 * @param message MAVLink message, as received from the MAVLink protocol stack
 */
void QGXPX4UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
{
    UAS::receiveMessage(link, message);
}

void QGXPX4UAS::processParamValueMsgHook(mavlink_message_t& msg, const QString& paramName,const mavlink_param_value_t& rawValue, mavlink_param_union_t& paramValue)
{
23 24 25
    Q_UNUSED(rawValue);
    Q_UNUSED(paramValue);

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
    int compId = msg.compid;
    if (paramName == "SYS_AUTOSTART") {

        bool ok;

        int val = parameters.value(compId)->value(paramName).toInt(&ok);

        if (ok && val == 0) {
            emit misconfigurationDetected(this);
            qDebug() << "HINTING MISCONFIGURATION";
        }

        qDebug() << "SYS_AUTOSTART FOUND WITH VAL: " << val;
    }
}