mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
OP-935 Adds checkbox for 'real time updates' to basic screen. Disables controls when no board is connected.
This commit is contained in:
parent
a5f87bea62
commit
2d409188f8
@ -91,6 +91,13 @@ void MyTabbedStackWidget::removeTab(int index)
|
||||
delete item;
|
||||
}
|
||||
|
||||
void MyTabbedStackWidget::setWidgetsEnabled(bool enabled)
|
||||
{
|
||||
for(int i = 0; i < m_stackWidget->count(); i++) {
|
||||
m_stackWidget->widget(i)->setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
int MyTabbedStackWidget::currentIndex() const
|
||||
{
|
||||
return m_listWidget->currentRow();
|
||||
|
@ -47,6 +47,8 @@ public:
|
||||
void removeTab(int index);
|
||||
void setIconSize(int size) { m_listWidget->setIconSize(QSize(size, size)); }
|
||||
|
||||
void setWidgetsEnabled(bool enabled);
|
||||
|
||||
int currentIndex() const;
|
||||
|
||||
void insertCornerWidget(int index, QWidget *widget);
|
||||
|
@ -49,8 +49,6 @@
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QPushButton>
|
||||
|
||||
|
||||
|
||||
ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
@ -144,6 +142,8 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
oplinkTimeout = new QTimer(this);
|
||||
connect(oplinkTimeout, SIGNAL(timeout()), this, SLOT(onOPLinkDisconnect()));
|
||||
oplinkConnected = false;
|
||||
|
||||
ftw->setWidgetsEnabled(false);
|
||||
}
|
||||
|
||||
ConfigGadgetWidget::~ConfigGadgetWidget()
|
||||
@ -165,6 +165,8 @@ void ConfigGadgetWidget::resizeEvent(QResizeEvent *event)
|
||||
}
|
||||
|
||||
void ConfigGadgetWidget::onAutopilotDisconnect() {
|
||||
ftw->setWidgetsEnabled(false);
|
||||
|
||||
int selectedIndex = ftw->currentIndex();
|
||||
|
||||
QIcon *icon = new QIcon();
|
||||
@ -234,8 +236,9 @@ void ConfigGadgetWidget::onAutopilotConnect() {
|
||||
//Unknown board
|
||||
qDebug() << "Unknown board " << board;
|
||||
}
|
||||
ftw->setCurrentIndex(selectedIndex);
|
||||
ftw->setCurrentIndex(selectedIndex);
|
||||
}
|
||||
ftw->setWidgetsEnabled(true);
|
||||
emit autopilotConnected();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configstabilizationwidget.h
|
||||
* @file configstabilizationwidget.cpp
|
||||
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
@ -36,42 +36,42 @@
|
||||
#include <QUrl>
|
||||
#include <QList>
|
||||
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/generalsettings.h>
|
||||
|
||||
|
||||
ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
{
|
||||
m_stabilization = new Ui_StabilizationWidget();
|
||||
m_stabilization->setupUi(this);
|
||||
|
||||
|
||||
ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance();
|
||||
Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>();
|
||||
if(!settings->useExpertMode())
|
||||
ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance();
|
||||
Core::Internal::GeneralSettings* settings = pm->getObject<Core::Internal::GeneralSettings>();
|
||||
if(!settings->useExpertMode()) {
|
||||
m_stabilization->saveStabilizationToRAM_6->setVisible(false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
autoLoadWidgets();
|
||||
realtimeUpdates=new QTimer(this);
|
||||
connect(m_stabilization->realTimeUpdates_6,SIGNAL(stateChanged(int)),this,SLOT(realtimeUpdatesSlot(int)));
|
||||
connect(realtimeUpdates,SIGNAL(timeout()),this,SLOT(apply()));
|
||||
realtimeUpdates = new QTimer(this);
|
||||
|
||||
connect(m_stabilization->checkBox_7,SIGNAL(stateChanged(int)),this,SLOT(linkCheckBoxes(int)));
|
||||
connect(m_stabilization->checkBox_2,SIGNAL(stateChanged(int)),this,SLOT(linkCheckBoxes(int)));
|
||||
connect(m_stabilization->checkBox_8,SIGNAL(stateChanged(int)),this,SLOT(linkCheckBoxes(int)));
|
||||
connect(m_stabilization->checkBox_3,SIGNAL(stateChanged(int)),this,SLOT(linkCheckBoxes(int)));
|
||||
connect(m_stabilization->realTimeUpdates_6, SIGNAL(stateChanged(int)), this, SLOT(realtimeUpdatesSlot(int)));
|
||||
connect(m_stabilization->realTimeUpdates_8, SIGNAL(stateChanged(int)), this, SLOT(realtimeUpdatesSlot(int)));
|
||||
connect(realtimeUpdates, SIGNAL(timeout()), this, SLOT(apply()));
|
||||
|
||||
connect(this,SIGNAL(widgetContentsChanged(QWidget*)),this,SLOT(processLinkedWidgets(QWidget*)));
|
||||
connect(m_stabilization->checkBox_7, SIGNAL(stateChanged(int)), this, SLOT(linkCheckBoxes(int)));
|
||||
connect(m_stabilization->checkBox_2, SIGNAL(stateChanged(int)), this, SLOT(linkCheckBoxes(int)));
|
||||
connect(m_stabilization->checkBox_8, SIGNAL(stateChanged(int)), this, SLOT(linkCheckBoxes(int)));
|
||||
connect(m_stabilization->checkBox_3, SIGNAL(stateChanged(int)), this, SLOT(linkCheckBoxes(int)));
|
||||
|
||||
connect(this, SIGNAL(widgetContentsChanged(QWidget*)), this, SLOT(processLinkedWidgets(QWidget*)));
|
||||
|
||||
// Link by default
|
||||
m_stabilization->checkBox_7->setChecked(true);
|
||||
m_stabilization->checkBox_8->setChecked(true);
|
||||
|
||||
disableMouseWheelEvents();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
ConfigStabilizationWidget::~ConfigStabilizationWidget()
|
||||
{
|
||||
// Do nothing
|
||||
@ -80,22 +80,30 @@ ConfigStabilizationWidget::~ConfigStabilizationWidget()
|
||||
void ConfigStabilizationWidget::realtimeUpdatesSlot(int value)
|
||||
{
|
||||
m_stabilization->realTimeUpdates_6->setCheckState((Qt::CheckState)value);
|
||||
if(value==Qt::Checked && !realtimeUpdates->isActive())
|
||||
m_stabilization->realTimeUpdates_8->setCheckState((Qt::CheckState)value);
|
||||
|
||||
if(value == Qt::Checked && !realtimeUpdates->isActive()) {
|
||||
realtimeUpdates->start(300);
|
||||
else if(value==Qt::Unchecked)
|
||||
}
|
||||
else if(value == Qt::Unchecked) {
|
||||
realtimeUpdates->stop();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigStabilizationWidget::linkCheckBoxes(int value)
|
||||
{
|
||||
if(sender()== m_stabilization->checkBox_7)
|
||||
if(sender() == m_stabilization->checkBox_7) {
|
||||
m_stabilization->checkBox_3->setCheckState((Qt::CheckState)value);
|
||||
else if(sender()== m_stabilization->checkBox_3)
|
||||
}
|
||||
else if(sender() == m_stabilization->checkBox_3) {
|
||||
m_stabilization->checkBox_7->setCheckState((Qt::CheckState)value);
|
||||
else if(sender()== m_stabilization->checkBox_8)
|
||||
}
|
||||
else if(sender( )== m_stabilization->checkBox_8) {
|
||||
m_stabilization->checkBox_2->setCheckState((Qt::CheckState)value);
|
||||
else if(sender()== m_stabilization->checkBox_2)
|
||||
}
|
||||
else if(sender() == m_stabilization->checkBox_2) {
|
||||
m_stabilization->checkBox_8->setCheckState((Qt::CheckState)value);
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigStabilizationWidget::processLinkedWidgets(QWidget * widget)
|
||||
|
@ -25,15 +25,18 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="textBrowser">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt; font-weight:600;">Hardware Configuration</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt; font-weight:600;"></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt; font-weight:600;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">This panel will be updated to provide the relevant controls to let you configure your hardware once telemetry is connected and running.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"></p></body></html></string>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>965</width>
|
||||
<height>687</height>
|
||||
<width>1076</width>
|
||||
<height>834</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -600,17 +600,11 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>937</width>
|
||||
<height>595</height>
|
||||
<width>1046</width>
|
||||
<height>751</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12" stretch="0,0,0,0">
|
||||
<property name="spacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="RateStabilizationGroup_15">
|
||||
<property name="sizePolicy">
|
||||
@ -6770,71 +6764,118 @@ border-radius: 5;</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>62</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Integral</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<property name="margin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="lowThrottleZeroIntegral_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>62</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Integral</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<property name="margin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>When the throttle is low, zero the intergral term to prevent intergral wind-up</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zero the integral when throttle is low</string>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<stringlist>
|
||||
<string>objname:StabilizationSettings</string>
|
||||
<string>fieldname:LowThrottleZeroIntegral</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="lowThrottleZeroIntegral_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>When the throttle is low, zero the intergral term to prevent intergral wind-up</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zero the integral when throttle is low</string>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<stringlist>
|
||||
<string>objname:StabilizationSettings</string>
|
||||
<string>fieldname:LowThrottleZeroIntegral</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Instant Update</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="realTimeUpdates_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>136</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enabling this feature mean that any changes made to the sliders will be instantly sent and used by the Flight Controller, useful for two person tuning where one normally flies and ones changes the GCS.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update flight controller in real time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
@ -6937,8 +6978,8 @@ border-radius: 5;</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>540</width>
|
||||
<height>663</height>
|
||||
<width>1046</width>
|
||||
<height>751</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
@ -16860,8 +16901,8 @@ border-radius: 5;</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>802</width>
|
||||
<height>607</height>
|
||||
<width>1046</width>
|
||||
<height>751</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
@ -24815,7 +24856,7 @@ border-radius: 5;</string>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Real Time Updates</string>
|
||||
<string>Instant Update</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
@ -24833,14 +24874,13 @@ border-radius: 5;</string>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>If you check this, the GCS will udpate the stabilization factors
|
||||
automatically every 300ms, which will help for fast tuning.</string>
|
||||
<string>Enabling this feature mean that any changes made to the sliders will be instantly sent and used by the Flight Controller, useful for two person tuning where one normally flies and ones changes the GCS.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update in real time</string>
|
||||
<string>Update flight controller in real time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -25101,7 +25141,6 @@ Useful if you have accidentally changed some settings.</string>
|
||||
<tabstop>RollRateKd</tabstop>
|
||||
<tabstop>PitchRateKd</tabstop>
|
||||
<tabstop>YawRateKd</tabstop>
|
||||
<tabstop>scrollArea</tabstop>
|
||||
<tabstop>pushButton_2</tabstop>
|
||||
<tabstop>AttitudeRollKp</tabstop>
|
||||
<tabstop>AttitudePitchKp_2</tabstop>
|
||||
|
Loading…
x
Reference in New Issue
Block a user