Commit 13cc2cfb authored by Don Gagne's avatar Don Gagne

Pass in autopilot type

parent bbdfdd90
......@@ -391,7 +391,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
}
// Create a new UAS object
uas = QGCMAVLinkUASFactory::createUAS(this, link, message.sysid, &heartbeat);
uas = QGCMAVLinkUASFactory::createUAS(this, link, message.sysid, (MAV_AUTOPILOT)heartbeat.autopilot);
}
......
......@@ -6,26 +6,13 @@ QGCMAVLinkUASFactory::QGCMAVLinkUASFactory(QObject *parent) :
{
}
UASInterface* QGCMAVLinkUASFactory::createUAS(MAVLinkProtocol* mavlink, LinkInterface* link, int sysid, mavlink_heartbeat_t* heartbeat, QObject* parent)
UASInterface* QGCMAVLinkUASFactory::createUAS(MAVLinkProtocol* mavlink, LinkInterface* link, int sysid, MAV_AUTOPILOT autopilotType)
{
QPointer<QObject> p;
if (parent != NULL)
{
p = parent;
}
else
{
p = mavlink;
}
UASInterface* uasInterface;
UAS* uasObject = new UAS(mavlink, sysid);
UAS* uasObject = new UAS(mavlink, sysid, autopilotType);
Q_CHECK_PTR(uasObject);
uasInterface = uasObject;
uasObject->setSystemType((int)heartbeat->type);
// Connect this robot to the UAS object
// It is IMPORTANT here to use the right object type,
......@@ -33,9 +20,6 @@ UASInterface* QGCMAVLinkUASFactory::createUAS(MAVLinkProtocol* mavlink, LinkInte
// packets never reach their goal)
connect(mavlink, &MAVLinkProtocol::messageReceived, uasObject, &UAS::receiveMessage);
// Set the autopilot type
uasInterface->setAutopilotType((int)heartbeat->autopilot);
// Make UAS aware that this link can be used to communicate with the actual robot
uasInterface->addLink(link);
......
......@@ -18,7 +18,7 @@ public:
explicit QGCMAVLinkUASFactory(QObject *parent = 0);
/** @brief Create a new UAS object using MAVLink as protocol */
static UASInterface* createUAS(MAVLinkProtocol* mavlink, LinkInterface* link, int sysid, mavlink_heartbeat_t* heartbeat, QObject* parent=NULL);
static UASInterface* createUAS(MAVLinkProtocol* mavlink, LinkInterface* link, int sysid, MAV_AUTOPILOT autopilotType);
signals:
......
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