1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

OP-38 Separated airframe type from RC output, added telemetry settings. Larger icons on left side menu.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1317 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2010-08-18 09:38:25 +00:00 committed by edouard
parent be2f5bbf70
commit 587e10fc43
8 changed files with 411 additions and 63 deletions

View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AircraftWidget</class>
<widget class="QWidget" name="AircraftWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>720</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>491</width>
<height>321</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QPushButton" name="saveAircraftToSD">
<property name="geometry">
<rect>
<x>380</x>
<y>280</y>
<width>93</width>
<height>27</height>
</rect>
</property>
<property name="toolTip">
<string>Be sure to set the Neutral position on all sliders before sending!
Applies and Saves all settings to SD</string>
</property>
<property name="text">
<string>Save to SD</string>
</property>
</widget>
<widget class="QPushButton" name="saveAircraftToRAM">
<property name="geometry">
<rect>
<x>270</x>
<y>280</y>
<width>93</width>
<height>27</height>
</rect>
</property>
<property name="toolTip">
<string>Send to OpenPilot but don't write in SD.
Be sure to set the Neutral position on all sliders before sending!</string>
</property>
<property name="text">
<string>Save to RAM</string>
</property>
</widget>
<widget class="QPushButton" name="getAircraftCurrent">
<property name="geometry">
<rect>
<x>160</x>
<y>280</y>
<width>93</width>
<height>27</height>
</rect>
</property>
<property name="toolTip">
<string>Retrieve settings from OpenPilot</string>
</property>
<property name="text">
<string>Get Current</string>
</property>
</widget>
<widget class="QComboBox" name="aircraftType">
<property name="geometry">
<rect>
<x>110</x>
<y>20</y>
<width>121</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="toolTip">
<string>Select aircraft type here</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>91</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Aircraft type:</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,22 +1,24 @@
TEMPLATE = lib
TARGET = Config
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/uavobjects/uavobjects.pri)
OTHER_FILES += Config.pluginspec
HEADERS += configplugin.h \
configgadgetconfiguration.h \
configgadgetwidget.h \
configgadgetfactory.h \
configgadgetoptionspage.h \
configgadget.h \
fancytabwidget.h
SOURCES += configplugin.cpp \
configgadgetconfiguration.cpp \
configgadgetwidget.cpp \
configgadgetfactory.cpp \
configgadgetoptionspage.cpp \
configgadget.cpp \
fancytabwidget.cpp
FORMS += settingswidget.ui
RESOURCES += configgadget.qrc
TEMPLATE = lib
TARGET = Config
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/uavobjects/uavobjects.pri)
OTHER_FILES += Config.pluginspec
HEADERS += configplugin.h \
configgadgetconfiguration.h \
configgadgetwidget.h \
configgadgetfactory.h \
configgadgetoptionspage.h \
configgadget.h \
fancytabwidget.h
SOURCES += configplugin.cpp \
configgadgetconfiguration.cpp \
configgadgetwidget.cpp \
configgadgetfactory.cpp \
configgadgetoptionspage.cpp \
configgadget.cpp \
fancytabwidget.cpp
FORMS += settingswidget.ui \
airframe.ui \
telemetry.ui
RESOURCES += configgadget.qrc

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/configgadget">
<file>images/XBee.svg</file>
<file>images/Airframe.png</file>
</qresource>
</RCC>

View File

@ -2,7 +2,7 @@
******************************************************************************
*
* @file configgadgetwidget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
@ -25,7 +25,6 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "configgadgetwidget.h"
#include "ui_settingswidget.h"
#include "fancytabwidget.h"
@ -42,7 +41,7 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
{
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
FancyTabWidget *ftw = new FancyTabWidget(this, true);
ftw->setIconSize(32);
ftw->setIconSize(64);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(ftw);
setLayout(layout);
@ -51,7 +50,13 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
m_config->setupUi(qwd);
ftw->insertTab(0, qwd,QIcon(":/core/images/pluginicon.png"),QString("RC Input/Output"));
qwd = new QWidget;
ftw->insertTab(1,qwd,QIcon(":/configgadget/images/XBee.svg"), QString("Telemetry"));
m_aircraft = new Ui_AircraftWidget();
m_aircraft->setupUi(qwd);
ftw->insertTab(1, qwd, QIcon(":/configgadget/images/Airframe.png"), QString("Aircraft"));
qwd = new QWidget;
m_telemetry = new Ui_TelemetryWidget();
m_telemetry->setupUi(qwd);
ftw->insertTab(2,qwd,QIcon(":/configgadget/images/XBee.svg"), QString("Telemetry"));
// Fill in the dropdown menus for the channel RC Input assignement.
QStringList channelsList;
@ -79,11 +84,15 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
UAVObjectField *field = obj->getField(fieldName);
m_config->receiverType->addItems(field->getOptions());
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("TelemetrySettings")));
field = obj->getField(QString("Speed"));
m_telemetry->telemetrySpeed->addItems(field->getOptions());
// Same for the aircraft types:
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("SystemSettings")));
fieldName = QString("AirframeType");
field = obj->getField(fieldName);
m_config->aircraftType->addItems(field->getOptions());
m_aircraft->aircraftType->addItems(field->getOptions());
// And for the channel output assignement options
m_config->ch0Output->addItem("None");
@ -142,6 +151,15 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
connect(m_config->saveRCOutputToRAM, SIGNAL(clicked()), this, SLOT(sendRCOutputUpdate()));
connect(m_config->getRCOutputCurrent, SIGNAL(clicked()), this, SLOT(requestRCOutputUpdate()));
requestAircraftUpdate();
connect(m_aircraft->saveAircraftToSD, SIGNAL(clicked()), this, SLOT(saveAircraftUpdate()));
connect(m_aircraft->saveAircraftToRAM, SIGNAL(clicked()), this, SLOT(sendAircraftUpdate()));
connect(m_aircraft->getAircraftCurrent, SIGNAL(clicked()), this, SLOT(requestAircraftUpdate()));
requestTelemetryUpdate();
connect(m_telemetry->saveTelemetryToSD, SIGNAL(clicked()), this, SLOT(saveTelemetryUpdate()));
connect(m_telemetry->saveTelemetryToRAM, SIGNAL(clicked()), this, SLOT(sendTelemetryUpdate()));
connect(m_telemetry->getTelemetryCurrent, SIGNAL(clicked()), this, SLOT(requestTelemetryUpdate()));
firstUpdate = true;
@ -159,6 +177,104 @@ void ConfigGadgetWidget::resizeEvent(QResizeEvent *event)
QWidget::resizeEvent(event);
}
/**************************
* Aircraft settings
**************************/
/**
Request the current value of the SystemSettings which holds the aircraft type
*/
void ConfigGadgetWidget::requestAircraftUpdate()
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
// Get the Airframe type from the system settings:
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("SystemSettings")));
Q_ASSERT(obj);
obj->requestUpdate();
UAVObjectField *field = obj->getField(QString("AirframeType"));
m_config->aircraftType->setText(QString("Aircraft type: ") + field->getValue().toString());
m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText(field->getValue().toString()));
}
/**
Sends the config to the board (airframe type)
*/
void ConfigGadgetWidget::sendAircraftUpdate()
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("SystemSettings")));
Q_ASSERT(obj);
UAVObjectField* field = obj->getField(QString("AirframeType"));
field->setValue(m_aircraft->aircraftType->currentText());
obj->updated();
}
/**
Send airframe type to the board and request saving to SD card
*/
void ConfigGadgetWidget::saveAircraftUpdate()
{
// Send update so that the latest value is saved
sendAircraftUpdate();
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("SystemSettings")));
Q_ASSERT(obj);
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
}
/*******************************
* Telemetry Settings
*****************************/
/**
Request telemetry settings from the board
*/
void ConfigGadgetWidget::requestTelemetryUpdate()
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("TelemetrySettings")));
Q_ASSERT(obj);
obj->requestUpdate();
UAVObjectField *field = obj->getField(QString("Speed"));
m_telemetry->telemetrySpeed->setCurrentIndex(m_telemetry->telemetrySpeed->findText(field->getValue().toString()));
}
/**
Send telemetry settings to the board
*/
void ConfigGadgetWidget::sendTelemetryUpdate()
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("TelemetrySettings")));
Q_ASSERT(obj);
UAVObjectField* field = obj->getField(QString("Speed"));
field->setValue(m_telemetry->telemetrySpeed->currentText());
obj->updated();
}
/**
Send telemetry settings to the board and request saving to SD card
*/
void ConfigGadgetWidget::saveTelemetryUpdate()
{
// Send update so that the latest value is saved
sendTelemetryUpdate();
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("TelemetrySettings")));
Q_ASSERT(obj);
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
}
/********************************
* Output settings
*******************************/
@ -177,7 +293,7 @@ void ConfigGadgetWidget::requestRCOutputUpdate()
Q_ASSERT(obj);
obj->requestUpdate();
UAVObjectField *field = obj->getField(QString("AirframeType"));
m_config->aircraftType->setCurrentIndex(m_config->aircraftType->findText(field->getValue().toString()));
m_config->aircraftType->setText(QString("Aircraft type: ") + field->getValue().toString());
// Reset all channel assignements:
m_config->ch0Output->setCurrentIndex(0);
@ -351,14 +467,6 @@ void ConfigGadgetWidget::sendRCOutputUpdate()
obj->updated();
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("SystemSettings")));
Q_ASSERT(obj);
field = obj->getField(QString("AirframeType"));
field->setValue(m_config->aircraftType->currentText());
// ... and send to the OP Board
obj->updated();
}
@ -375,9 +483,11 @@ void ConfigGadgetWidget::saveRCOutputObject()
Q_ASSERT(obj);
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("SystemSettings")));
Q_ASSERT(obj);
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
/*
UAVDataObject* obj2 = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("SystemSettings")));
Q_ASSERT(obj2);
updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj2);
*/
}

View File

@ -28,6 +28,8 @@
#define CONFIGGADGETWIDGET_H
#include "ui_settingswidget.h"
#include "ui_telemetry.h"
#include "ui_airframe.h"
#include "extensionsystem/pluginmanager.h"
#include "uavobjects/uavobjectmanager.h"
#include "uavobjects/uavobject.h"
@ -50,6 +52,8 @@ protected:
private:
Ui_SettingsWidget *m_config;
Ui_TelemetryWidget *m_telemetry;
Ui_AircraftWidget *m_aircraft;
QList<QSlider> sliders;
void updateChannelSlider(QSlider* slider, QLabel* min, QLabel* Max, QCheckBox* rev, int value);
void updateObjectPersistance(ObjectPersistence::OperationOptions op, UAVObject *obj);
@ -66,6 +70,12 @@ private:
void requestRCOutputUpdate();
void sendRCOutputUpdate();
void saveRCOutputObject();
void requestAircraftUpdate();
void sendAircraftUpdate();
void saveAircraftUpdate();
void requestTelemetryUpdate();
void sendTelemetryUpdate();
void saveTelemetryUpdate();
void setch0OutRange();
void setch1OutRange();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>664</width>
<height>409</height>
<width>720</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
@ -23,7 +23,7 @@
</rect>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -1120,35 +1120,17 @@ Uncheck/Check to restart calibration.</string>
<attribute name="title">
<string>Servo Output</string>
</attribute>
<widget class="QComboBox" name="aircraftType">
<property name="geometry">
<rect>
<x>100</x>
<y>20</y>
<width>121</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="toolTip">
<string>Select aircraft type here</string>
</property>
</widget>
<widget class="QLabel" name="label">
<widget class="QLabel" name="aircraftType">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>91</width>
<width>221</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Aircraft type:</string>
<string>Aircraft type: undefined</string>
</property>
</widget>
<widget class="QLabel" name="actuator0Label">

View File

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TelemetryWidget</class>
<widget class="QWidget" name="TelemetryWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>720</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>411</width>
<height>321</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QTextBrowser" name="textBrowser">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>361</width>
<height>151</height>
</rect>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Set the serial speed of your telemetry modem here. It is the speed between the OpenPilot board and the modem, and could be different from the radio link speed.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Beware of not locking yourself out! You should only modify this setting when the OpenPilot board is connected through the USB port.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>200</y>
<width>131</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Telemetry speed:</string>
</property>
</widget>
<widget class="QComboBox" name="telemetrySpeed">
<property name="geometry">
<rect>
<x>140</x>
<y>190</y>
<width>141</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="saveTelemetryToRAM">
<property name="geometry">
<rect>
<x>190</x>
<y>280</y>
<width>93</width>
<height>27</height>
</rect>
</property>
<property name="toolTip">
<string>Send to OpenPilot but don't write in SD.
Be sure to set the Neutral position on all sliders before sending!</string>
</property>
<property name="text">
<string>Save to RAM</string>
</property>
</widget>
<widget class="QPushButton" name="getTelemetryCurrent">
<property name="geometry">
<rect>
<x>80</x>
<y>280</y>
<width>93</width>
<height>27</height>
</rect>
</property>
<property name="toolTip">
<string>Retrieve settings from OpenPilot</string>
</property>
<property name="text">
<string>Get Current</string>
</property>
</widget>
<widget class="QPushButton" name="saveTelemetryToSD">
<property name="geometry">
<rect>
<x>300</x>
<y>280</y>
<width>93</width>
<height>27</height>
</rect>
</property>
<property name="toolTip">
<string>Be sure to set the Neutral position on all sliders before sending!
Applies and Saves all settings to SD</string>
</property>
<property name="text">
<string>Save to SD</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>