|
|
|
@ -25,13 +25,14 @@
@@ -25,13 +25,14 @@
|
|
|
|
|
/// @author Don Gagne <don@thegagnes.com>
|
|
|
|
|
|
|
|
|
|
#include "APMAirframeComponent.h" |
|
|
|
|
#include "QGCQmlWidgetHolder.h" |
|
|
|
|
#include "ArduCopterFirmwarePlugin.h" |
|
|
|
|
|
|
|
|
|
APMAirframeComponent::APMAirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : |
|
|
|
|
APMComponent(vehicle, autopilot, parent), |
|
|
|
|
_name(tr("Airframe")) |
|
|
|
|
APMAirframeComponent::APMAirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) |
|
|
|
|
: APMComponent(vehicle, autopilot, parent) |
|
|
|
|
, _copterFirmware(false) |
|
|
|
|
, _name("Airframe") |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
_copterFirmware = qobject_cast<ArduCopterFirmwarePlugin*>(_vehicle->firmwarePlugin()) != NULL; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QString APMAirframeComponent::name(void) const |
|
|
|
@ -52,28 +53,45 @@ QString APMAirframeComponent::iconResource(void) const
@@ -52,28 +53,45 @@ QString APMAirframeComponent::iconResource(void) const
|
|
|
|
|
|
|
|
|
|
bool APMAirframeComponent::requiresSetup(void) const |
|
|
|
|
{ |
|
|
|
|
return true; |
|
|
|
|
return _copterFirmware; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool APMAirframeComponent::setupComplete(void) const |
|
|
|
|
{ |
|
|
|
|
//: Not the correct one, but it works for the moment.
|
|
|
|
|
return _autopilot->getParameterFact(FactSystem::defaultComponentId, "FRAME")->rawValue().toInt() != -1; |
|
|
|
|
if (_copterFirmware) { |
|
|
|
|
return _autopilot->getParameterFact(FactSystem::defaultComponentId, "FRAME")->rawValue().toInt() >= 0; |
|
|
|
|
} else { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QStringList APMAirframeComponent::setupCompleteChangedTriggerList(void) const |
|
|
|
|
{ |
|
|
|
|
return QStringList(); |
|
|
|
|
QStringList list; |
|
|
|
|
|
|
|
|
|
if (_copterFirmware) { |
|
|
|
|
list << "FRAME"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QUrl APMAirframeComponent::setupSource(void) const |
|
|
|
|
{ |
|
|
|
|
return QUrl::fromUserInput("qrc:/qml/APMAirframeComponent.qml"); |
|
|
|
|
if (_copterFirmware) { |
|
|
|
|
return QUrl::fromUserInput("qrc:/qml/APMAirframeComponent.qml"); |
|
|
|
|
} else { |
|
|
|
|
return QUrl(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QUrl APMAirframeComponent::summaryQmlSource(void) const |
|
|
|
|
{ |
|
|
|
|
return QUrl::fromUserInput("qrc:/qml/APMAirframeComponentSummary.qml"); |
|
|
|
|
if (_copterFirmware) { |
|
|
|
|
return QUrl::fromUserInput("qrc:/qml/APMAirframeComponentSummary.qml"); |
|
|
|
|
} else { |
|
|
|
|
return QUrl(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QString APMAirframeComponent::prerequisiteSetup(void) const |
|
|
|
|