mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-05 16:46:06 +01:00
OP-39 Added code to jump from the SetupWizard directly to the InputWizard in the ConfigurationPlugin to complete the vehicle setup and realize the 1-2-Fly idea.
Re-factored some code in the ConfigurationPlugin. Fixed a bug in the Levelling page when performing levelling multiple times.
This commit is contained in:
parent
40d5761a1d
commit
86f210e7f4
@ -52,6 +52,7 @@ public:
|
|||||||
void insertCornerWidget(int index, QWidget *widget);
|
void insertCornerWidget(int index, QWidget *widget);
|
||||||
int cornerWidgetCount() { return m_cornerWidgetCount; }
|
int cornerWidgetCount() { return m_cornerWidgetCount; }
|
||||||
QWidget * currentWidget(){return m_stackWidget->currentWidget();}
|
QWidget * currentWidget(){return m_stackWidget->currentWidget();}
|
||||||
|
QWidget * getWidget(int index) {return m_stackWidget->widget(index);}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentAboutToShow(int index,bool * proceed);
|
void currentAboutToShow(int index,bool * proceed);
|
||||||
|
@ -25,14 +25,14 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
#include "configgadgetfactory.h"
|
#include "configgadgetfactory.h"
|
||||||
#include "configgadgetwidget.h"
|
|
||||||
#include "configgadget.h"
|
#include "configgadget.h"
|
||||||
#include "configgadgetconfiguration.h"
|
#include "configgadgetconfiguration.h"
|
||||||
#include "configgadgetoptionspage.h"
|
#include "configgadgetoptionspage.h"
|
||||||
#include <coreplugin/iuavgadget.h>
|
#include <coreplugin/iuavgadget.h>
|
||||||
|
|
||||||
ConfigGadgetFactory::ConfigGadgetFactory(QObject *parent) :
|
ConfigGadgetFactory::ConfigGadgetFactory(QObject *parent) :
|
||||||
IUAVGadgetFactory(QString("ConfigGadget"), tr("Config Gadget"), parent)
|
IUAVGadgetFactory(QString("ConfigGadget"), tr("Config Gadget"), parent),
|
||||||
|
gadgetWidget(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ ConfigGadgetFactory::~ConfigGadgetFactory()
|
|||||||
|
|
||||||
Core::IUAVGadget* ConfigGadgetFactory::createGadget(QWidget *parent)
|
Core::IUAVGadget* ConfigGadgetFactory::createGadget(QWidget *parent)
|
||||||
{
|
{
|
||||||
ConfigGadgetWidget* gadgetWidget = new ConfigGadgetWidget(parent);
|
gadgetWidget = new ConfigGadgetWidget(parent);
|
||||||
return new ConfigGadget(QString("ConfigGadget"), gadgetWidget, parent);
|
return new ConfigGadget(QString("ConfigGadget"), gadgetWidget, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,3 +55,8 @@ IOptionsPage *ConfigGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *co
|
|||||||
{
|
{
|
||||||
return new ConfigGadgetOptionsPage(qobject_cast<ConfigGadgetConfiguration*>(config));
|
return new ConfigGadgetOptionsPage(qobject_cast<ConfigGadgetConfiguration*>(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigGadgetFactory::startInputWizard()
|
||||||
|
{
|
||||||
|
gadgetWidget->startInputWizard();
|
||||||
|
}
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
#define CONFIGGADGETFACTORY_H
|
#define CONFIGGADGETFACTORY_H
|
||||||
|
|
||||||
#include <coreplugin/iuavgadgetfactory.h>
|
#include <coreplugin/iuavgadgetfactory.h>
|
||||||
|
#include "configgadgetwidget.h"
|
||||||
|
#include "config_global.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class IUAVGadget;
|
class IUAVGadget;
|
||||||
@ -36,7 +39,7 @@ class IUAVGadgetFactory;
|
|||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
class ConfigGadgetFactory: public Core::IUAVGadgetFactory
|
class CONFIG_EXPORT ConfigGadgetFactory: public Core::IUAVGadgetFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@ -47,6 +50,10 @@ public:
|
|||||||
IUAVGadget *createGadget(QWidget *parent);
|
IUAVGadget *createGadget(QWidget *parent);
|
||||||
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
|
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
|
||||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||||
|
void startInputWizard();
|
||||||
|
|
||||||
|
private:
|
||||||
|
ConfigGadgetWidget* gadgetWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONFIGGADGETFACTORY_H
|
#endif // CONFIGGADGETFACTORY_H
|
||||||
|
@ -127,6 +127,14 @@ ConfigGadgetWidget::~ConfigGadgetWidget()
|
|||||||
// TODO: properly delete all the tabs in ftw before exiting
|
// TODO: properly delete all the tabs in ftw before exiting
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigGadgetWidget::startInputWizard()
|
||||||
|
{
|
||||||
|
ftw->setCurrentIndex(ConfigGadgetWidget::input);
|
||||||
|
ConfigInputWidget* inputWidget = dynamic_cast<ConfigInputWidget*>(ftw->getWidget(ConfigGadgetWidget::input));
|
||||||
|
Q_ASSERT(inputWidget);
|
||||||
|
inputWidget->startInputWizard();
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigGadgetWidget::resizeEvent(QResizeEvent *event)
|
void ConfigGadgetWidget::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ public:
|
|||||||
ConfigGadgetWidget(QWidget *parent = 0);
|
ConfigGadgetWidget(QWidget *parent = 0);
|
||||||
~ConfigGadgetWidget();
|
~ConfigGadgetWidget();
|
||||||
enum widgetTabs {hardware=0, aircraft, input, output, sensors, stabilization, camerastabilization, txpid, pipxtreme};
|
enum widgetTabs {hardware=0, aircraft, input, output, sensors, stabilization, camerastabilization, txpid, pipxtreme};
|
||||||
|
void startInputWizard();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onAutopilotConnect();
|
void onAutopilotConnect();
|
||||||
|
@ -280,6 +280,7 @@ void ConfigInputWidget::openHelp()
|
|||||||
|
|
||||||
QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Input+Configuration", QUrl::StrictMode) );
|
QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Input+Configuration", QUrl::StrictMode) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigInputWidget::goToWizard()
|
void ConfigInputWidget::goToWizard()
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
enum txMovements{moveLeftVerticalStick,moveRightVerticalStick,moveLeftHorizontalStick,moveRightHorizontalStick,moveAccess0,moveAccess1,moveAccess2,moveFlightMode,centerAll,moveAll,nothing};
|
enum txMovements{moveLeftVerticalStick,moveRightVerticalStick,moveLeftHorizontalStick,moveRightHorizontalStick,moveAccess0,moveAccess1,moveAccess2,moveFlightMode,centerAll,moveAll,nothing};
|
||||||
enum txMovementType{vertical,horizontal,jump,mix};
|
enum txMovementType{vertical,horizontal,jump,mix};
|
||||||
enum txType {acro, heli};
|
enum txType {acro, heli};
|
||||||
public slots:
|
void startInputWizard() { goToWizard(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool growing;
|
bool growing;
|
||||||
@ -133,6 +133,7 @@ private:
|
|||||||
|
|
||||||
void wizardSetUpStep(enum wizardSteps);
|
void wizardSetUpStep(enum wizardSteps);
|
||||||
void wizardTearDownStep(enum wizardSteps);
|
void wizardTearDownStep(enum wizardSteps);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void wzNext();
|
void wzNext();
|
||||||
void wzBack();
|
void wzBack();
|
||||||
@ -150,11 +151,10 @@ private slots:
|
|||||||
void invertControls();
|
void invertControls();
|
||||||
void simpleCalibration(bool state);
|
void simpleCalibration(bool state);
|
||||||
void updateCalibration();
|
void updateCalibration();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
virtual void enableControls(bool enable);
|
virtual void enableControls(bool enable);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -26,16 +26,32 @@
|
|||||||
*/
|
*/
|
||||||
#include "endpage.h"
|
#include "endpage.h"
|
||||||
#include "ui_endpage.h"
|
#include "ui_endpage.h"
|
||||||
|
#include <coreplugin/modemanager.h>
|
||||||
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
#include <configgadgetfactory.h>
|
||||||
|
|
||||||
EndPage::EndPage(SetupWizard *wizard, QWidget *parent) :
|
EndPage::EndPage(SetupWizard *wizard, QWidget *parent) :
|
||||||
AbstractWizardPage(wizard, parent),
|
AbstractWizardPage(wizard, parent),
|
||||||
ui(new Ui::EndPage)
|
ui(new Ui::EndPage)
|
||||||
{
|
{
|
||||||
setFinalPage(true);
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
setFinalPage(true);
|
||||||
|
connect(ui->inputWizardButton, SIGNAL(clicked()), this, SLOT(openInputWizard()));
|
||||||
}
|
}
|
||||||
|
|
||||||
EndPage::~EndPage()
|
EndPage::~EndPage()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EndPage::openInputWizard()
|
||||||
|
{
|
||||||
|
Core::ModeManager::instance()->activateModeByWorkspaceName("Configuration");
|
||||||
|
|
||||||
|
getWizard()->close();
|
||||||
|
|
||||||
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
|
ConfigGadgetFactory* configGadgetFactory = pm->getObject<ConfigGadgetFactory>();
|
||||||
|
Q_ASSERT(configGadgetFactory);
|
||||||
|
configGadgetFactory->startInputWizard();
|
||||||
|
}
|
||||||
|
@ -42,6 +42,9 @@ public:
|
|||||||
explicit EndPage(SetupWizard *wizard, QWidget *parent = 0);
|
explicit EndPage(SetupWizard *wizard, QWidget *parent = 0);
|
||||||
~EndPage();
|
~EndPage();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void openInputWizard();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::EndPage *ui;
|
Ui::EndPage *ui;
|
||||||
};
|
};
|
||||||
|
@ -51,16 +51,18 @@ bool LevellingPage::validatePage()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LevellingPage::isComplete()
|
bool LevellingPage::isComplete() const
|
||||||
{
|
{
|
||||||
return getWizard()->isLevellingPerformed();
|
return const_cast<LevellingPage *>(this)->getWizard()->isLevellingPerformed() &&
|
||||||
|
ui->levelButton->isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevellingPage::performLevelling()
|
void LevellingPage::performLevelling()
|
||||||
{
|
{
|
||||||
if(!getWizard()->getConnectionManager()->isConnected()) {
|
if(!getWizard()->getConnectionManager()->isConnected()) {
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText(tr("An OpenPilot controller must be connected to your computer to perform bias calculations.\nPlease connect your OpenPilot controller to continue."));
|
msgBox.setText(tr("An OpenPilot controller must be connected to your computer to perform bias "
|
||||||
|
"calculations.\nPlease connect your OpenPilot controller to continue."));
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
@ -69,14 +71,14 @@ void LevellingPage::performLevelling()
|
|||||||
|
|
||||||
if(!m_levellingUtil)
|
if(!m_levellingUtil)
|
||||||
{
|
{
|
||||||
ui->levelButton->setEnabled(false);
|
|
||||||
|
|
||||||
// Measure every 100ms * 100times = 10s
|
// Measure every 100ms * 100times = 10s
|
||||||
m_levellingUtil = new LevellingUtil(BIAS_CYCLES, BIAS_PERIOD);
|
m_levellingUtil = new LevellingUtil(BIAS_CYCLES, BIAS_PERIOD);
|
||||||
|
}
|
||||||
connect(m_levellingUtil, SIGNAL(progress(long,long)), this, SLOT(levellingProgress(long,long)));
|
connect(m_levellingUtil, SIGNAL(progress(long,long)), this, SLOT(levellingProgress(long,long)));
|
||||||
connect(m_levellingUtil, SIGNAL(done(accelGyroBias)), this, SLOT(levellingDone(accelGyroBias)));
|
connect(m_levellingUtil, SIGNAL(done(accelGyroBias)), this, SLOT(levellingDone(accelGyroBias)));
|
||||||
connect(m_levellingUtil, SIGNAL(timeout(QString)), this, SLOT(levellingTimeout(QString)));
|
connect(m_levellingUtil, SIGNAL(timeout(QString)), this, SLOT(levellingTimeout(QString)));
|
||||||
}
|
ui->levelButton->setEnabled(false);
|
||||||
|
emit completeChanged();
|
||||||
m_levellingUtil->start();
|
m_levellingUtil->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
explicit LevellingPage(SetupWizard *wizard, QWidget *parent = 0);
|
explicit LevellingPage(SetupWizard *wizard, QWidget *parent = 0);
|
||||||
~LevellingPage();
|
~LevellingPage();
|
||||||
bool validatePage();
|
bool validatePage();
|
||||||
bool isComplete();
|
bool isComplete() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void performLevelling();
|
void performLevelling();
|
||||||
|
@ -172,7 +172,7 @@ QString SetupWizard::getSummaryText()
|
|||||||
|
|
||||||
summary.append('\n');
|
summary.append('\n');
|
||||||
summary.append(tr("ESC type: "));
|
summary.append(tr("ESC type: "));
|
||||||
switch (getInputType())
|
switch (getESCType())
|
||||||
{
|
{
|
||||||
case ESC_DEFAULT:
|
case ESC_DEFAULT:
|
||||||
summary.append(tr("Default ESC (50 Hz)"));
|
summary.append(tr("Default ESC (50 Hz)"));
|
||||||
|
@ -6,6 +6,7 @@ QT += svg
|
|||||||
include(../../openpilotgcsplugin.pri)
|
include(../../openpilotgcsplugin.pri)
|
||||||
include(../../plugins/coreplugin/coreplugin.pri)
|
include(../../plugins/coreplugin/coreplugin.pri)
|
||||||
include(../../plugins/uavobjectutil/uavobjectutil.pri)
|
include(../../plugins/uavobjectutil/uavobjectutil.pri)
|
||||||
|
include(../../plugins/config/config.pri)
|
||||||
|
|
||||||
HEADERS += setupwizardplugin.h \
|
HEADERS += setupwizardplugin.h \
|
||||||
setupwizard.h \
|
setupwizard.h \
|
||||||
|
Loading…
Reference in New Issue
Block a user