Commit 6261e761 authored by Don Gagne's avatar Don Gagne

FactPanel V2

parent c8b92a9a
......@@ -620,7 +620,6 @@ INCLUDEPATH += \
HEADERS += \
src/FactSystem/Fact.h \
src/FactSystem/FactBinder.h \
src/FactSystem/FactMetaData.h \
src/FactSystem/FactSystem.h \
src/FactSystem/FactValidator.h \
......@@ -629,7 +628,6 @@ HEADERS += \
SOURCES += \
src/FactSystem/Fact.cc \
src/FactSystem/FactBinder.cc \
src/FactSystem/FactMetaData.cc \
src/FactSystem/FactSystem.cc \
src/FactSystem/FactValidator.cc \
......
......@@ -112,14 +112,14 @@ void AutoPilotPlugin::refreshParametersPrefix(int componentId, const QString& na
_getParameterLoader()->refreshParametersPrefix(componentId, namePrefix);
}
bool AutoPilotPlugin::parameterExists(const QString& name)
bool AutoPilotPlugin::parameterExists(int componentId, const QString& name)
{
return _getParameterLoader()->parameterExists(FactSystem::defaultComponentId, name);
return _getParameterLoader()->parameterExists(componentId, name);
}
Fact* AutoPilotPlugin::getParameterFact(const QString& name)
Fact* AutoPilotPlugin::getParameterFact(int componentId, const QString& name)
{
return _getParameterLoader()->getFact(FactSystem::defaultComponentId, name);
return _getParameterLoader()->getFact(componentId, name);
}
bool AutoPilotPlugin::factExists(FactSystem::Provider_t provider, int componentId, const QString& name)
......
......@@ -71,16 +71,16 @@ public:
Q_INVOKABLE void refreshParametersPrefix(int componentId, const QString& namePrefix);
/// Returns true if the specifed parameter exists from the default component
Q_INVOKABLE bool parameterExists(const QString& name);
Q_INVOKABLE bool parameterExists(int componentId, const QString& name);
/// Returns all parameter names
/// FIXME: component id missing, generic to fact
QStringList parameterNames(void);
/// Returns the specified parameter Fact from the default component
/// WARNING: Will assert if fact does not exists. If that possibility exists, check for existince first with
/// factExists.
Fact* getParameterFact(const QString& name);
/// WARNING: Returns a default Fact if parameter does not exists. If that possibility exists, check for existince first with
/// parameterExists.
Fact* getParameterFact(int componentId, const QString& name);
/// Writes the parameter facts to the specified stream
void writeParametersToStream(QTextStream &stream);
......
......@@ -142,7 +142,7 @@ bool AirframeComponent::requiresSetup(void) const
bool AirframeComponent::setupComplete(void) const
{
return _autopilot->getParameterFact("SYS_AUTOSTART")->value().toInt() != 0;
return _autopilot->getParameterFact(FactSystem::defaultComponentId, "SYS_AUTOSTART")->value().toInt() != 0;
}
QString AirframeComponent::setupStateDescription(void) const
......
......@@ -31,6 +31,7 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
id: rootQGCView
......@@ -67,7 +68,7 @@ QGCView {
"This configuration can only be modified through the Parameter Editor.\n\n" +
"If you want to Reset your airframe configuration and select a standard configuration, click 'Reset' above."
Fact { id: sys_autostart; name: "SYS_AUTOSTART" }
property Fact sys_autostart: controller.getParameterFact(-1, "SYS_AUTOSTART")
function accept() {
sys_autostart.value = 0
......@@ -107,7 +108,7 @@ QGCView {
QGCLabel {
id: header
width: parent.width
font.pointSize: 20
font.pointSize: ScreenTools.largeFontPointSize
text: "AIRFRAME CONFIG"
}
......
......@@ -48,16 +48,16 @@ AirframeComponentController::AirframeComponentController(void) :
qmlRegisterUncreatableType<Airframe>("QGroundControl.Controllers", 1, 0, "Aiframe", "Can only reference Airframe");
}
QStringList usedFacts;
usedFacts << "SYS_AUTOSTART" << "SYS_AUTOCONFIG";
if (!_allFactsExists(usedFacts)) {
QStringList usedParams;
usedParams << "SYS_AUTOSTART" << "SYS_AUTOCONFIG";
if (!_allParametersExists(FactSystem::defaultComponentId, usedParams)) {
return;
}
// Load up member variables
bool autostartFound = false;
_autostartId = _autopilot->getParameterFact("SYS_AUTOSTART")->value().toInt();
_autostartId = getParameterFact(FactSystem::defaultComponentId, "SYS_AUTOSTART")->value().toInt();
for (const AirframeComponentAirframes::AirframeType_t* pType=&AirframeComponentAirframes::rgAirframeTypes[0]; pType->name != NULL; pType++) {
AirframeType* airframeType = new AirframeType(pType->name, pType->imageResource, this);
......@@ -99,9 +99,8 @@ void AirframeComponentController::changeAutostart(void)
qgcApp()->setOverrideCursor(Qt::WaitCursor);
_autopilot->getParameterFact("SYS_AUTOSTART")->setValue(_autostartId);
_autopilot->getParameterFact("SYS_AUTOCONFIG")->setValue(1);
getParameterFact(-1, "SYS_AUTOSTART")->setValue(_autostartId);
getParameterFact(-1, "SYS_AUTOCONFIG")->setValue(1);
// Wait for the parameters to flow through system
qgcApp()->processEvents(QEventLoop::ExcludeUserInputEvents);
......
......@@ -5,15 +5,18 @@ import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
AirframeComponentController { id: controller; factPanel: panel }
Fact { id: sysIdFact; name: "MAV_SYS_ID"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: sysAutoStartFact; name: "SYS_AUTOSTART"; onFactMissing: showMissingFactOverlay(name) }
property Fact sysIdFact: controller.getParameterFact(-1, "MAV_SYS_ID")
property Fact sysAutoStartFact: controller.getParameterFact(-1, "SYS_AUTOSTART")
property bool autoStartSet: sysAutoStartFact.value != 0
......
......@@ -73,7 +73,7 @@ bool FlightModesComponent::requiresSetup(void) const
bool FlightModesComponent::setupComplete(void) const
{
return _autopilot->getParameterFact("RC_MAP_MODE_SW")->value().toInt() != 0;
return _autopilot->getParameterFact(FactSystem::defaultComponentId, "RC_MAP_MODE_SW")->value().toInt() != 0;
}
QString FlightModesComponent::setupStateDescription(void) const
......
......@@ -34,13 +34,14 @@ import QGroundControl.ScreenTools 1.0
Item {
Loader {
property FlightModesComponentController controller: FlightModesComponentController { }
id: loader
anchors.fill: parent
sourceComponent: controller.validConfiguration ? validComponent : invalidComponent
property FlightModesComponentController controller: FlightModesComponentController { factPanel: loader.item }
property QGCPalette qgcPal: QGCPalette { colorGroupEnabled: true }
property bool loading: true
anchors.fill: parent
sourceComponent: controller.validConfiguration ? validComponent : invalidComponent
onLoaded: loading = false
}
......@@ -48,30 +49,28 @@ Item {
id: validComponent
FactPanel {
Fact { id: rc_map_throttle; name: "RC_MAP_THROTTLE"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_yaw; name: "RC_MAP_YAW"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_pitch; name: "RC_MAP_PITCH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_roll; name: "RC_MAP_ROLL"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_flaps; name: "RC_MAP_FLAPS"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_aux1; name: "RC_MAP_AUX1"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_aux2; name: "RC_MAP_AUX2"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_mode_sw; name: "RC_MAP_MODE_SW"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_posctl_sw; name: "RC_MAP_POSCTL_SW"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_return_sw; name: "RC_MAP_RETURN_SW"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_offboard_sw; name: "RC_MAP_OFFB_SW"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_loiter_sw; name: "RC_MAP_LOITER_SW"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_map_acro_sw; name: "RC_MAP_ACRO_SW"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_posctl_th; name: "RC_POSCTL_TH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_return_th; name: "RC_RETURN_TH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_offboard_th; name: "RC_OFFB_TH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_loiter_th; name: "RC_LOITER_TH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_acro_th; name: "RC_ACRO_TH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_assist_th; name: "RC_ASSIST_TH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_auto_th; name: "RC_AUTO_TH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: rc_th_user; name: "RC_TH_USER"; onFactMissing: showMissingFactOverlay(name) }
property Fact rc_map_throttle: controller.getParameterFact(-1, "RC_MAP_THROTTLE")
property Fact rc_map_yaw: controller.getParameterFact(-1, "RC_MAP_YAW")
property Fact rc_map_pitch: controller.getParameterFact(-1, "RC_MAP_PITCH")
property Fact rc_map_roll: controller.getParameterFact(-1, "RC_MAP_ROLL")
property Fact rc_map_flaps: controller.getParameterFact(-1, "RC_MAP_FLAPS")
property Fact rc_map_aux1: controller.getParameterFact(-1, "RC_MAP_AUX1")
property Fact rc_map_aux2: controller.getParameterFact(-1, "RC_MAP_AUX2")
property Fact rc_map_mode_sw: controller.getParameterFact(-1, "RC_MAP_MODE_SW")
property Fact rc_map_posctl_sw: controller.getParameterFact(-1, "RC_MAP_POSCTL_SW")
property Fact rc_map_return_sw: controller.getParameterFact(-1, "RC_MAP_RETURN_SW")
property Fact rc_map_offboard_sw: controller.getParameterFact(-1, "RC_MAP_OFFB_SW")
property Fact rc_map_loiter_sw: controller.getParameterFact(-1, "RC_MAP_LOITER_SW")
property Fact rc_assist_th: controller.getParameterFact(-1, "RC_ASSIST_TH")
property Fact rc_posctl_th: controller.getParameterFact(-1, "RC_POSCTL_TH")
property Fact rc_auto_th: controller.getParameterFact(-1, "RC_AUTO_TH")
property Fact rc_loiter_th: controller.getParameterFact(-1, "RC_LOITER_TH")
property Fact rc_return_th: controller.getParameterFact(-1, "RC_RETURN_TH")
property Fact rc_offboard_th: controller.getParameterFact(-1, "RC_OFFB_TH")
property Fact rc_th_user: controller.getParameterFact(-1, "RC_TH_USER")
property int throttleChannel: rc_map_throttle.value
property int yawChannel: rc_map_yaw.value
......@@ -135,7 +134,7 @@ Item {
id: unassignedModeTileComponent
Rectangle {
Fact { id: fact; name: tileParam; onFactMissing: showMissingFactOverlay(name) }
property Fact fact: controller.getParameterFact(-1, tileParam)
property bool dragEnabled: fact.value == 0
id: outerRect
......@@ -221,7 +220,8 @@ Item {
id: assignedModeTileComponent
Rectangle {
Fact { id: fact; name: tileDragEnabled ? tileParam : ""; onFactMissing: showMissingFactOverlay(name) }
Fact{ id: nullFact }
property Fact fact: tileDragEnabled ? controller.getParameterFact(-1, tileParam) : nullFact
width: tileWidth
height: tileHeight
......@@ -362,7 +362,7 @@ Item {
QGCLabel {
text: "FLIGHT MODES CONFIG"
font.pointSize: ScreenTools.fontPointFactor * (20);
font.pointSize: ScreenTools.largeFontPointSize
}
Item { height: 20; width: 10 } // spacer
......@@ -624,10 +624,10 @@ Item {
Item { height: 20; width: 10 } // spacer
FactCheckBox {
checkedValue: 0
checkedValue: 0
uncheckedValue: 1
fact: rc_th_user
text: "Allow setup to generate the thresholds for the flight mode positions within a switch (recommended)"
fact: rc_th_user
text: "Allow setup to generate the thresholds for the flight mode positions within a switch (recommended)"
}
Item { height: 20; width: 10 } // spacer
......@@ -639,8 +639,9 @@ Item {
text: "Switch Display"
}
QGCCheckBox {
checked: controller.sendLiveRCSwitchRanges
text: "Show live RC display"
checked: controller.sendLiveRCSwitchRanges
text: "Show live RC display"
onClicked: {
controller.sendLiveRCSwitchRanges = checked
}
......@@ -650,11 +651,11 @@ Item {
Item { height: 20; width: 10 } // spacer
Row {
property bool modeSwitchVisible: modeChannel != 0
property bool loiterSwitchVisible: loiterChannel != 0 && loiterChannel != modeChannel && loiterChannel != returnChannel
property bool posCtlSwitchVisible: posCtlChannel != 0 && posCtlChannel != modeChannel
property bool returnSwitchVisible: returnChannel != 0
property bool offboardSwitchVisible: offboardChannel != 0
property bool modeSwitchVisible: modeChannel != 0
property bool loiterSwitchVisible: loiterChannel != 0 && loiterChannel != modeChannel && loiterChannel != returnChannel
property bool posCtlSwitchVisible: posCtlChannel != 0 && posCtlChannel != modeChannel
property bool returnSwitchVisible: returnChannel != 0
property bool offboardSwitchVisible: offboardChannel != 0
width: parent.width
spacing: 20
......@@ -882,7 +883,7 @@ Item {
Component {
id: invalidComponent
Rectangle {
FactPanel {
anchors.fill: parent
color: qgcPal.window
......
......@@ -32,20 +32,17 @@
#include <QVariant>
#include <QQmlProperty>
FlightModesComponentController::FlightModesComponentController(QObject* parent) :
QObject(parent),
FlightModesComponentController::FlightModesComponentController(void) :
_liveRCValues(false),
_validConfiguration(false),
_channelCount(18),
_autoPilotPlugin(NULL)
_channelCount(18)
{
_uas = UASManager::instance()->getActiveUAS();
Q_ASSERT(_uas);
QStringList usedParams;
usedParams << "RC_MAP_THROTTLE" << "RC_MAP_YAW" << "RC_MAP_PITCH" << "RC_MAP_ROLL" << "RC_MAP_FLAPS" << "RC_MAP_AUX1" << "RC_MAP_AUX2" << "RC_MAP_ACRO_SW";
if (!_allParametersExists(FactSystem::defaultComponentId, usedParams)) {
return;
}
_autoPilotPlugin = AutoPilotPluginManager::instance()->getInstanceForAutoPilotPlugin(_uas);
Q_ASSERT(_autoPilotPlugin);
Q_ASSERT(_autoPilotPlugin->pluginReady());
_initRcValues();
_validateConfiguration();
}
......@@ -69,16 +66,14 @@ void FlightModesComponentController::_validateConfiguration(void)
{
_validConfiguration = true;
_channelCount = _autoPilotPlugin->parameterExists("RC_CHAN_CNT") ?
_autoPilotPlugin->getParameterFact("RC_CHAN_CNT")->value().toInt() :
_chanMax;
_channelCount = parameterExists(FactSystem::defaultComponentId, "RC_CHAN_CNT") ? getParameterFact(FactSystem::defaultComponentId, "RC_CHAN_CNT")->value().toInt() : _chanMax;
if (_channelCount <= 0 || _channelCount > _chanMax) {
// Parameter exists, but has not yet been set or is invalid. Use default
_channelCount = _chanMax;
}
// Acro is not full supported yet. If Acro is mapped you uhave to set up the hard way.
if (_autoPilotPlugin->getParameterFact("RC_MAP_ACRO_SW")->value().toInt() != 0) {
if (getParameterFact(FactSystem::defaultComponentId, "RC_MAP_ACRO_SW")->value().toInt() != 0) {
_validConfiguration = false;
_configurationErrors += "Flight Mode setup does not yet support Acro switch";
}
......@@ -92,7 +87,7 @@ void FlightModesComponentController::_validateConfiguration(void)
switchNames << "Mode Switch" << "Return Switch" << "Loiter Switch" << "PosCtl Switch" << "Offboard Switch";
for(int i=0; i<switchParams.count(); i++) {
int map = _autoPilotPlugin->getParameterFact(switchParams[i])->value().toInt();
int map = getParameterFact(FactSystem::defaultComponentId, switchParams[i])->value().toInt();
switchMappings << map;
if (map < 0 || map > _channelCount) {
......@@ -109,7 +104,7 @@ void FlightModesComponentController::_validateConfiguration(void)
attitudeNames << "Throttle" << "Yaw" << "Pitch" << "Roll" << "Flaps" << "Aux1" << "Aux2" << "Acro";
for (int i=0; i<attitudeParams.count(); i++) {
int map = _autoPilotPlugin->getParameterFact(attitudeParams[i])->value().toInt();
int map = getParameterFact(FactSystem::defaultComponentId, attitudeParams[i])->value().toInt();
for (int j=0; j<switchParams.count(); j++) {
if (map != 0 && map == switchMappings[j]) {
......@@ -127,7 +122,7 @@ void FlightModesComponentController::_validateConfiguration(void)
singleSwitchNames << "Return Switch" << "Offboard Switch";
for (int i=0; i<singleSwitchParams.count(); i++) {
int map = _autoPilotPlugin->getParameterFact(singleSwitchParams[i])->value().toInt();
int map = getParameterFact(FactSystem::defaultComponentId, singleSwitchParams[i])->value().toInt();
for (int j=0; j<switchParams.count(); j++) {
if (map != 0 && singleSwitchParams[i] != switchParams[j] && map == switchMappings[j]) {
......@@ -152,10 +147,10 @@ void FlightModesComponentController::setSendLiveRCSwitchRanges(bool start)
QVariant value;
_rgRCMin[i] = _autoPilotPlugin->getParameterFact(rcMinParam)->value().toInt();
_rgRCMax[i] = _autoPilotPlugin->getParameterFact(rcMaxParam)->value().toInt();
_rgRCMin[i] = getParameterFact(FactSystem::defaultComponentId, rcMinParam)->value().toInt();
_rgRCMax[i] = getParameterFact(FactSystem::defaultComponentId, rcMaxParam)->value().toInt();
float floatReversed = _autoPilotPlugin->getParameterFact(rcRevParam)->value().toFloat();
float floatReversed = getParameterFact(-1, rcRevParam)->value().toFloat();
_rgRCReversed[i] = floatReversed == -1.0f;
}
......@@ -196,7 +191,7 @@ double FlightModesComponentController::_switchLiveRange(const QString& param)
{
QVariant value;
int channel = _autoPilotPlugin->getParameterFact(param)->value().toInt();
int channel = getParameterFact(-1, param)->value().toInt();
if (channel == 0) {
return 1.0;
} else {
......
......@@ -33,14 +33,15 @@
#include "UASInterface.h"
#include "AutoPilotPlugin.h"
#include "FactPanelController.h"
/// MVC Controller for FlightModesComponent.qml.
class FlightModesComponentController : public QObject
class FlightModesComponentController : public FactPanelController
{
Q_OBJECT
public:
FlightModesComponentController(QObject* parent = NULL);
FlightModesComponentController(void);
~FlightModesComponentController();
Q_PROPERTY(bool validConfiguration MEMBER _validConfiguration CONSTANT)
......@@ -79,8 +80,6 @@ private:
static const int _chanMax = 18;
UASInterface* _uas;
QList<double> _rcValues;
bool _liveRCValues;
int _rgRCMin[_chanMax];
......@@ -90,8 +89,6 @@ private:
bool _validConfiguration;
QString _configurationErrors;
int _channelCount;
AutoPilotPlugin* _autoPilotPlugin;
};
#endif
......@@ -4,14 +4,20 @@ import QtQuick.Controls 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
anchors.fill: parent
id: panel
anchors.fill: parent
color: qgcPal.windowShadeDark
Fact { id: modeSwFact; name: "RC_MAP_MODE_SW"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: posCtlSwFact; name: "RC_MAP_POSCTL_SW"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: loiterSwFact; name: "RC_MAP_LOITER_SW"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: returnSwFact; name: "RC_MAP_RETURN_SW"; onFactMissing: showMissingFactOverlay(name) }
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
property Fact modeSwFact: controller.getParameterFact(-1, "RC_MAP_MODE_SW")
property Fact posCtlSwFact: controller.getParameterFact(-1, "RC_MAP_POSCTL_SW")
property Fact loiterSwFact: controller.getParameterFact(-1, "RC_MAP_LOITER_SW")
property Fact returnSwFact: controller.getParameterFact(-1, "RC_MAP_RETURN_SW")
Column {
anchors.fill: parent
......
......@@ -249,7 +249,7 @@ void PX4AutoPilotPlugin::_pluginReadyPreChecks(void)
// Check for older parameter version set
// FIXME: Firmware is moving to version stamp parameter set. Once that is complete the version stamp
// should be used instead.
if (parameterExists("SENS_GYRO_XOFF")) {
if (parameterExists(FactSystem::defaultComponentId, "SENS_GYRO_XOFF")) {
_incorrectParameterVersion = true;
QGCMessageBox::warning("Setup", "This version of GroundControl can only perform vehicle setup on a newer version of firmware. "
"Please perform a Firmware Upgrade if you wish to use Vehicle Setup.");
......
......@@ -39,7 +39,7 @@ void PX4Component::setupTriggerSignals(void)
{
// Watch for changed on trigger list params
foreach (QString paramName, setupCompleteChangedTriggerList()) {
Fact* fact = _autopilot->getParameterFact(paramName);
Fact* fact = _autopilot->getParameterFact(FactSystem::defaultComponentId, paramName);
connect(fact, &Fact::valueChanged, this, &PX4Component::_triggerUpdated);
}
......
......@@ -58,9 +58,9 @@ bool PowerComponent::requiresSetup(void) const
bool PowerComponent::setupComplete(void) const
{
QVariant cvalue, evalue, nvalue;
return _autopilot->getParameterFact("BAT_V_CHARGED")->value().toFloat() != 0.0f &&
_autopilot->getParameterFact("BAT_V_EMPTY")->value().toFloat() != 0.0f &&
_autopilot->getParameterFact("BAT_N_CELLS")->value().toInt() != 0;
return _autopilot->getParameterFact(FactSystem::defaultComponentId, "BAT_V_CHARGED")->value().toFloat() != 0.0f &&
_autopilot->getParameterFact(FactSystem::defaultComponentId, "BAT_V_EMPTY")->value().toFloat() != 0.0f &&
_autopilot->getParameterFact(FactSystem::defaultComponentId, "BAT_N_CELLS")->value().toInt() != 0;
}
QString PowerComponent::setupStateDescription(void) const
......
......@@ -55,9 +55,10 @@ QGCView {
property int firstColumnWidth: 220
property int textEditWidth: 80
property Fact battNumCells: Fact { name: "BAT_N_CELLS"; onFactMissing: showMissingFactOverlay(name) }
property Fact battHighVolt: Fact { name: "BAT_V_CHARGED"; onFactMissing: showMissingFactOverlay(name) }
property Fact battLowVolt: Fact { name: "BAT_V_EMPTY"; onFactMissing: showMissingFactOverlay(name) }
property Fact battNumCells: controller.getParameterFact(-1, "BAT_N_CELLS")
property Fact battHighVolt: controller.getParameterFact(-1, "BAT_V_CHARGED")
property Fact battLowVolt: controller.getParameterFact(-1, "BAT_V_EMPTY")
property Fact battVoltLoadDrop: controller.getParameterFact(-1, "BAT_V_LOAD_DROP")
property alias battHigh: battHighRow
property alias battLow: battLowRow
......@@ -150,7 +151,7 @@ QGCView {
FactTextField {
id: cellsField
width: textEditWidth
fact: Fact { name: "BAT_N_CELLS"; onFactMissing: showMissingFactOverlay(name) }
fact: battNumCells
showUnits: true
}
}
......@@ -161,7 +162,7 @@ QGCView {
FactTextField {
id: battHighField
width: textEditWidth
fact: Fact { name: "BAT_V_CHARGED"; onFactMissing: showMissingFactOverlay(name) }
fact: battHighVolt
showUnits: true
}
}
......@@ -172,7 +173,7 @@ QGCView {
FactTextField {
id: battLowField
width: textEditWidth
fact: Fact { name: "BAT_V_EMPTY"; onFactMissing: showMissingFactOverlay(name) }
fact: battLowVolt
showUnits: true
}
}
......@@ -332,7 +333,7 @@ QGCView {
FactTextField {
id: battDropField
width: textEditWidth
fact: Fact { name: "BAT_V_LOAD_DROP"; onFactMissing: showMissingFactOverlay(name) }
fact: battVoltLoadDrop
showUnits: true
}
}
......
......@@ -31,13 +31,19 @@ import QtQuick.Controls 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
anchors.fill: parent
id: panel
anchors.fill: parent
color: qgcPal.windowShadeDark
Fact { id: batVChargedFact; name: "BAT_V_CHARGED"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: batVEmptyFact; name: "BAT_V_EMPTY"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: batCellsFact; name: "BAT_N_CELLS"; onFactMissing: showMissingFactOverlay(name) }
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
property Fact batVChargedFact: controller.getParameterFact(-1, "BAT_V_CHARGED")
property Fact batVEmptyFact: controller.getParameterFact(-1, "BAT_V_EMPTY")
property Fact batCellsFact: controller.getParameterFact(-1, "BAT_N_CELLS")
Column {
anchors.fill: parent
......
......@@ -62,7 +62,7 @@ bool RadioComponent::setupComplete(void) const
QStringList attitudeMappings;
attitudeMappings << "RC_MAP_ROLL" << "RC_MAP_PITCH" << "RC_MAP_YAW" << "RC_MAP_THROTTLE";
foreach(QString mapParam, attitudeMappings) {
if (_autopilot->getParameterFact(mapParam)->value().toInt() == 0) {
if (_autopilot->getParameterFact(FactSystem::defaultComponentId, mapParam)->value().toInt() == 0) {
return false;
}
}
......@@ -80,13 +80,13 @@ bool RadioComponent::setupComplete(void) const
QString param;
param = QString("RC%1_MIN").arg(i);
rcMin = _autopilot->getParameterFact(param)->value().toInt();
rcMin = _autopilot->getParameterFact(FactSystem::defaultComponentId, param)->value().toInt();
param = QString("RC%1_MAX").arg(i);
rcMax = _autopilot->getParameterFact(param)->value().toInt();
rcMax = _autopilot->getParameterFact(FactSystem::defaultComponentId, param)->value().toInt();
param = QString("RC%1_TRIM").arg(i);
rcTrim = _autopilot->getParameterFact(param)->value().toInt();
rcTrim = _autopilot->getParameterFact(FactSystem::defaultComponentId, param)->value().toInt();
if (rcMin == rcMinDefault && rcMax == rcMaxDefault && rcTrim == rcTrimDefault) {
return false;
......
......@@ -4,17 +4,23 @@ import QtQuick.Controls 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
anchors.fill: parent
Fact { id: mapRollFact; name: "RC_MAP_ROLL"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: mapPitchFact; name: "RC_MAP_PITCH"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: mapYawFact; name: "RC_MAP_YAW"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: mapThrottleFact; name: "RC_MAP_THROTTLE"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: mapFlapsFact; name: "RC_MAP_FLAPS"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: mapAux1Fact; name: "RC_MAP_AUX1"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: mapAux2Fact; name: "RC_MAP_AUX2"; onFactMissing: showMissingFactOverlay(name) }
id: panel
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
property Fact mapRollFact: controller.getParameterFact(-1, "RC_MAP_ROLL")
property Fact mapPitchFact: controller.getParameterFact(-1, "RC_MAP_PITCH")
property Fact mapYawFact: controller.getParameterFact(-1, "RC_MAP_YAW")
property Fact mapThrottleFact: controller.getParameterFact(-1, "RC_MAP_THROTTLE")
property Fact mapFlapsFact: controller.getParameterFact(-1, "RC_MAP_FLAPS")
property Fact mapAux1Fact: controller.getParameterFact(-1, "RC_MAP_AUX1")
property Fact mapAux2Fact: controller.getParameterFact(-1, "RC_MAP_AUX2")
Column {
anchors.fill: parent
......
......@@ -4,15 +4,21 @@ import QtQuick.Controls 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
anchors.fill: parent
Fact { id: returnAltFact; name: "RTL_RETURN_ALT"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: descendAltFact; name: "RTL_DESCEND_ALT"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: landDelayFact; name: "RTL_LAND_DELAY"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: commDLLossFact; name: "COM_DL_LOSS_EN"; onFactMissing: showMissingFactOverlay(name) }
Fact { id: commRCLossFact; name: "COM_RC_LOSS_T"; onFactMissing: showMissingFactOverlay(name) }
id: panel
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
property Fact returnAltFact: controller.getParameterFact(-1, "RTL_R