1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Add the outputpage for fixed wing support

This commit is contained in:
Fredrik Larson 2014-08-17 20:31:57 +10:00
parent dec52c675c
commit 3fc991fe2c
6 changed files with 269 additions and 4 deletions

View File

@ -0,0 +1,54 @@
/**
******************************************************************************
*
* @file outputpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup OutputPage
* @{
* @brief
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "outputpagefixedwing.h"
#include "ui_outputpagefixedwing.h"
#include "setupwizard.h"
OutputPageFixedwing::OutputPageFixedwing(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::OutputPageFixedwing)
{
ui->setupUi(this);
}
OutputPageFixedwing::~OutputPageFixedwing()
{
delete ui;
}
bool OutputPageFixedwing::validatePage()
{
if (ui->rapidESCButton->isChecked()) {
getWizard()->setESCType(SetupWizard::ESC_RAPID);
} else {
getWizard()->setESCType(SetupWizard::ESC_LEGACY);
}
return true;
}

View File

@ -0,0 +1,49 @@
/**
******************************************************************************
*
* @file outputpage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup OutputPage
* @{
* @brief
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OUTPUTPAGEFIXEDWING_H
#define OUTPUTPAGEFIXEDWING_H
#include "abstractwizardpage.h"
namespace Ui {
class OutputPageFixedwing;
}
class OutputPageFixedwing : public AbstractWizardPage {
Q_OBJECT
public:
explicit OutputPageFixedwing(SetupWizard *wizard, QWidget *parent = 0);
~OutputPage();
bool validatePage();
private:
Ui::OutputPageFixedwing *ui;
};
#endif // OUTPUTPAGEFIXEDWING_H

View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OutputPageFixedwing</class>
<widget class="QWizardPage" name="OutputPageFixedwing">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<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:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;OpenPilot Output Signal Configuration&lt;/span&gt;&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; font-size:12pt; font-weight:600;&quot;&gt;&lt;br /&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;&lt;span style=&quot; font-size:10pt;&quot;&gt;To set an optimal configuration of the output signals powering your servos, the wizard needs to know what type of servos you will use and what their capabilities are.&lt;/span&gt;&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; font-size:10pt;&quot;&gt;&lt;br /&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;&lt;span style=&quot; font-size:10pt;&quot;&gt;Please select one of the options below. If you are unsure about the capabilities of your servos, just leave the default option selected and continue the wizard.&lt;/span&gt;&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; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="defaultESCButton">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Standard ESC 50Hz</string>
</property>
<property name="styleSheet">
<string notr="true">QToolButton { border: none }</string>
</property>
<property name="text">
<string>Standard Servos</string>
</property>
<property name="icon">
<iconset resource="../wizardResources.qrc">
<normaloff>:/setupwizard/resources/bttn-ESC-up.png</normaloff>
<normalon>:/setupwizard/resources/bttn-ESC-down.png</normalon>:/setupwizard/resources/bttn-ESC-up.png</iconset>
</property>
<property name="iconSize">
<size>
<width>200</width>
<height>100</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="rapidESCButton">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Turbo PWM ESC 400Hz</string>
</property>
<property name="styleSheet">
<string notr="true">QToolButton { border: none }</string>
</property>
<property name="text">
<string>Digital Servos</string>
</property>
<property name="icon">
<iconset resource="../wizardResources.qrc">
<normaloff>:/setupwizard/resources/bttn-turbo-up.png</normaloff>
<normalon>:/setupwizard/resources/bttn-turbo-down.png</normalon>:/setupwizard/resources/bttn-turbo-up.png</iconset>
</property>
<property name="iconSize">
<size>
<width>200</width>
<height>100</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../wizardResources.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -36,6 +36,7 @@
#include "pages/surfacepage.h"
#include "pages/inputpage.h"
#include "pages/outputpage.h"
#include "pages/outputpagefixedwing.h"
#include "pages/biascalibrationpage.h"
#include "pages/summarypage.h"
#include "pages/savepage.h"
@ -113,7 +114,7 @@ int SetupWizard::nextId() const
return PAGE_OUTPUT;
case PAGE_FIXEDWING:
return PAGE_OUTPUT;
return PAGE_OUTPUT_FIXEDWING;
case PAGE_INPUT:
if (isRestartNeeded()) {
@ -128,6 +129,9 @@ int SetupWizard::nextId() const
case PAGE_OUTPUT:
return PAGE_SUMMARY;
case PAGE_OUTPUT_FIXEDWING:
return PAGE_SUMMARY;
case PAGE_BIAS_CALIBRATION:
return PAGE_OUTPUT_CALIBRATION;
@ -319,6 +323,7 @@ void SetupWizard::createPages()
setPage(PAGE_SURFACE, new SurfacePage(this));
setPage(PAGE_INPUT, new InputPage(this));
setPage(PAGE_OUTPUT, new OutputPage(this));
setPage(PAGE_OUTPUT_FIXEDWING, new OutputPageFixedwing(this));
setPage(PAGE_BIAS_CALIBRATION, new BiasCalibrationPage(this));
// setPage(PAGE_REVO_CALIBRATION, new RevoCalibrationPage(this));
setPage(PAGE_OUTPUT_CALIBRATION, new OutputCalibrationPage(this));

View File

@ -156,9 +156,10 @@ private slots:
void pageChanged(int currId);
private:
enum { PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING,
PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_OUTPUT, PAGE_BIAS_CALIBRATION,
PAGE_REVO_CALIBRATION, PAGE_OUTPUT_CALIBRATION, PAGE_SAVE, PAGE_SUMMARY,
PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END, PAGE_UPDATE };
PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_OUTPUT, PAGE_OUTPUT_FIXEDWING,
PAGE_BIAS_CALIBRATION,PAGE_REVO_CALIBRATION, PAGE_OUTPUT_CALIBRATION,
PAGE_SAVE, PAGE_SUMMARY,PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END,
PAGE_UPDATE };
void createPages();
bool saveHardwareSettings() const;
bool canAutoUpdate() const;

View File

@ -23,6 +23,7 @@ HEADERS += setupwizardplugin.h \
pages/surfacepage.h \
pages/abstractwizardpage.h \
pages/outputpage.h \
pages/outputpagefixedwing.h \
pages/inputpage.h \
pages/summarypage.h \
vehicleconfigurationsource.h \
@ -50,6 +51,7 @@ SOURCES += setupwizardplugin.cpp \
pages/surfacepage.cpp \
pages/abstractwizardpage.cpp \
pages/outputpage.cpp \
pages/outputpagefixedwing.cpp \
pages/inputpage.cpp \
pages/summarypage.cpp \
vehicleconfigurationsource.cpp \
@ -77,6 +79,7 @@ FORMS += \
pages/helipage.ui \
pages/surfacepage.ui \
pages/outputpage.ui \
pages/outputpagefixedwing.ui \
pages/inputpage.ui \
pages/summarypage.ui \
connectiondiagram.ui \