mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-10 18:24:11 +01:00
OP-38 Ground/Settings gadget : query uavobject properly for input channel assignements, so that any new input type is supported. Solves the issue with accessory inputs not appearing.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1547 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
e06162fa3a
commit
ce6a4325e4
@ -40,18 +40,6 @@ ConfigServoWidget::ConfigServoWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
|||||||
m_config = new Ui_SettingsWidget();
|
m_config = new Ui_SettingsWidget();
|
||||||
m_config->setupUi(this);
|
m_config->setupUi(this);
|
||||||
|
|
||||||
// Fill in the dropdown menus for the channel RC Input assignement.
|
|
||||||
QStringList channelsList;
|
|
||||||
channelsList << "None" << "Roll" << "Pitch" << "Yaw" << "Throttle" << "FlightMode";
|
|
||||||
m_config->ch0Assign->addItems(channelsList);
|
|
||||||
m_config->ch1Assign->addItems(channelsList);
|
|
||||||
m_config->ch2Assign->addItems(channelsList);
|
|
||||||
m_config->ch3Assign->addItems(channelsList);
|
|
||||||
m_config->ch4Assign->addItems(channelsList);
|
|
||||||
m_config->ch5Assign->addItems(channelsList);
|
|
||||||
m_config->ch6Assign->addItems(channelsList);
|
|
||||||
m_config->ch7Assign->addItems(channelsList);
|
|
||||||
|
|
||||||
// Now connect the widget to the ManualControlCommand / Channel UAVObject
|
// Now connect the widget to the ManualControlCommand / Channel UAVObject
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
@ -65,6 +53,26 @@ ConfigServoWidget::ConfigServoWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
|||||||
QString fieldName = QString("InputMode");
|
QString fieldName = QString("InputMode");
|
||||||
UAVObjectField *field = obj->getField(fieldName);
|
UAVObjectField *field = obj->getField(fieldName);
|
||||||
m_config->receiverType->addItems(field->getOptions());
|
m_config->receiverType->addItems(field->getOptions());
|
||||||
|
m_config->receiverType->setDisabled(true); // This option does not work for now, it is a compile-time option.
|
||||||
|
|
||||||
|
// Fill in the dropdown menus for the channel RC Input assignement.
|
||||||
|
QStringList channelsList;
|
||||||
|
channelsList << "None";
|
||||||
|
QList<UAVObjectField*> fieldList = obj->getFields();
|
||||||
|
foreach (UAVObjectField* field, fieldList) {
|
||||||
|
if (field->getUnits().contains("channel")) {
|
||||||
|
channelsList.append(field->getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_config->ch0Assign->addItems(channelsList);
|
||||||
|
m_config->ch1Assign->addItems(channelsList);
|
||||||
|
m_config->ch2Assign->addItems(channelsList);
|
||||||
|
m_config->ch3Assign->addItems(channelsList);
|
||||||
|
m_config->ch4Assign->addItems(channelsList);
|
||||||
|
m_config->ch5Assign->addItems(channelsList);
|
||||||
|
m_config->ch6Assign->addItems(channelsList);
|
||||||
|
m_config->ch7Assign->addItems(channelsList);
|
||||||
|
|
||||||
// And for the channel output assignement options
|
// And for the channel output assignement options
|
||||||
m_config->ch0Output->addItem("None");
|
m_config->ch0Output->addItem("None");
|
||||||
@ -77,12 +85,9 @@ ConfigServoWidget::ConfigServoWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
|||||||
m_config->ch7Output->addItem("None");
|
m_config->ch7Output->addItem("None");
|
||||||
|
|
||||||
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
|
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
|
||||||
QList<UAVObjectField*> fieldList = obj->getFields();
|
fieldList = obj->getFields();
|
||||||
foreach (UAVObjectField* field, fieldList) {
|
foreach (UAVObjectField* field, fieldList) {
|
||||||
// NOTE: we assume that all options in ActuatorSettings are a channel assignement
|
|
||||||
// except for the options called "ChannelXXX"
|
|
||||||
if (field->getUnits().contains("channel")) {
|
if (field->getUnits().contains("channel")) {
|
||||||
// if (!field->getName().contains("Channel")) {
|
|
||||||
m_config->ch0Output->addItem(field->getName());
|
m_config->ch0Output->addItem(field->getName());
|
||||||
m_config->ch1Output->addItem(field->getName());
|
m_config->ch1Output->addItem(field->getName());
|
||||||
m_config->ch2Output->addItem(field->getName());
|
m_config->ch2Output->addItem(field->getName());
|
||||||
|
Loading…
Reference in New Issue
Block a user