1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-21 13:28:58 +01:00

Make a start on GPS page

This commit is contained in:
Fredrik Larson 2014-09-03 07:16:36 +10:00
parent afeb464eb6
commit b93ff6bd89
7 changed files with 162 additions and 16 deletions

View File

@ -60,14 +60,14 @@ void AirSpeedPage::setupSelection(Selection *selection)
selection->addItem(tr("EagleTree"),
tr("Select this option to use the Airspeed MicroSensor V3 from EagleTree, this is an accurate "
"airspeed sensor that includes on-board Temperature Compensation.\n\n"
"Selecting this option will put your Flexi-Port in to I2C mode."),
"Selecting this option will set your board's Flexi-Port in to I2C mode."),
"eagletree",
SetupWizard::EAGLETREE);
selection->addItem(tr("MS4525 Based"),
tr("Select this option to use an airspeed sensor based on the MS4525DO pressure transducer "
"from Measurement Specialties. This includes the PixHawk sensor and their clones.\n\n"
"Selecting this option will put your Flexi-Port in to I2C mode."),
"Selecting this option will set your board's Flexi-Port in to I2C mode."),
"ms4525",
SetupWizard::MS4525);
}

View File

@ -0,0 +1,76 @@
/**
******************************************************************************
*
* @file fixedwingpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup FixedWingPage
* @{
* @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 "gpspage.h"
#include "setupwizard.h"
GpsPage::GpsPage(SetupWizard *wizard, QWidget *parent) :
SelectionPage(wizard, QString(":/setupwizard/resources/airspeed-shapes.svg"), parent)
{}
GpsPage::~GpsPage()
{}
bool GpsPage::validatePage(SelectionItem *seletedItem)
{
getWizard()->setGpsType((SetupWizard::GPS_TYPE)seletedItem->id());
return true;
}
void GpsPage::setupSelection(Selection *selection)
{
selection->setTitle(tr("OpenPilot GPS Selection"));
selection->setText(tr("Please select the type of GPS you have below. As well as OpenPilot hardware "
"OpenPilot works hard to support 3rd party GPSs as well, although performance could
"be less than with using OpenPilot produced hardware; not all GPSs are created equal.\n\n"
"Please select your GPS type data below:"));
selection->addItem(tr("Disabled"),
tr("GPS Features are not to be enabled"),
"disabled",
SetupWizard::GPS_DISABLED);
selection->addItem(tr("OpenPilot Platinum"),
tr("Select this option to use the OpenPilot Platinum GPS with integrated Magnetometer "
"and Microcontroller connected to the Main Port of your controller.\n\n"
"Note: for the OpenPilot v8 GPS please select the U-Blox option."),
"platinum",
SetupWizard::GPS_PLAT);
selection->addItem(tr("U-Blox Based"),
tr("Select this option for the OpenPilot V8 GPS or generic U-Blox chipset GPSs connected"
"to the Main Port of your controller."),
"ublox",
SetupWizard::GPS_UBX);
selection->addItem(tr("NMEA Based"),
tr("Select this option for a generic NMEA based GPS connected to the Main Port of your"
"controller."),
"nmea",
SetupWizard::GPS_NMEA);
}

View File

@ -0,0 +1,45 @@
/**
******************************************************************************
*
* @file fixedwingpage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup FixedWingPage
* @{
* @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 GPSPAGE_H
#define GPSPAGE_H
#include "selectionpage.h"
class GpsPage : public SelectionPage {
Q_OBJECT
public:
explicit GpsPage(SetupWizard *wizard, QWidget *parent = 0);
~GpsPage();
public:
bool validatePage(SelectionItem *seletedItem);
void setupSelection(Selection *selection);
};
#endif // GPSPAGE_H

View File

@ -33,6 +33,7 @@
#include "pages/multipage.h"
#include "pages/fixedwingpage.h"
#include "pages/airspeedpage.h"
#include "pages/gpspage.h"
#include "pages/helipage.h"
#include "pages/surfacepage.h"
#include "pages/inputpage.h"
@ -133,11 +134,23 @@ int SetupWizard::nextId() const
if (getVehicleSubType() == MULTI_ROTOR_TRI_Y) {
return PAGE_SERVO;
} else {
return PAGE_SUMMARY;
}
switch (getControllerType()) {
case CONTROLLER_REVO:
return PAGE_GPS;
default:
return PAGE_SUMMARY;
}
}
case PAGE_SERVO:
return PAGE_SUMMARY;
{
switch (getControllerType()) {
case CONTROLLER_REVO:
return PAGE_GPS;
default:
return PAGE_SUMMARY;
}
}
case PAGE_BIAS_CALIBRATION:
return PAGE_OUTPUT_CALIBRATION;
@ -148,9 +161,9 @@ int SetupWizard::nextId() const
{
switch (getVehicleType()) {
case VEHICLE_FIXEDWING:
return PAGE_AIRSPEED;
return PAGE_AIRFRAMESTAB_FIXEDWING;
// TODO: Pages for Multi and heli
// TODO: PID selection pages for multi and heli
case VEHICLE_MULTI:
case VEHICLE_HELI:
case VEHICLE_SURFACE:
@ -159,8 +172,17 @@ int SetupWizard::nextId() const
}
}
case PAGE_GPS:
switch (getVehicleType()) {
case VEHICLE_FIXEDWING:
return PAGE_AIRSPEED;
default:
return PAGE_SUMMARY;
}
case PAGE_AIRSPEED:
return PAGE_AIRFRAMESTAB_FIXEDWING;
return PAGE_SUMMARY;
case PAGE_AIRFRAMESTAB_FIXEDWING:
return PAGE_SAVE;
@ -364,6 +386,7 @@ void SetupWizard::createPages()
setPage(PAGE_MULTI, new MultiPage(this));
setPage(PAGE_FIXEDWING, new FixedWingPage(this));
setPage(PAGE_AIRSPEED, new AirSpeedPage(this));
setPage(PAGE_GPS, new GpsPage(this));
setPage(PAGE_HELI, new HeliPage(this));
setPage(PAGE_SURFACE, new SurfacePage(this));
setPage(PAGE_INPUT, new InputPage(this));

View File

@ -106,13 +106,13 @@ public:
}
void setGPSSetting(SetupWizard::GPS_SETTING setting)
void setGpsType(SetupWizard::GPS_TYPE setting)
{
m_gpsSetting = setting;
m_gpsType = setting;
}
SetupWizard::GPS_SETTING getGPSSetting() const
SetupWizard::GPS_TYPE getGpsType() const
{
return m_gpsSetting;
return m_gpsType;
}
void setRadioSetting(SetupWizard::RADIO_SETTING setting)
@ -175,7 +175,7 @@ private slots:
void pageChanged(int currId);
private:
enum { PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING,
PAGE_AIRSPEED, PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_ESC, PAGE_SERVO,
PAGE_AIRSPEED, PAGE_GPS, PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_ESC, PAGE_SERVO,
PAGE_BIAS_CALIBRATION, PAGE_REVO_CALIBRATION, PAGE_OUTPUT_CALIBRATION,
PAGE_SAVE, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_AIRFRAMESTAB_FIXEDWING,
PAGE_REBOOT, PAGE_END, PAGE_UPDATE };
@ -190,7 +190,7 @@ private:
ESC_TYPE m_escType;
SERVO_TYPE m_servoType;
AIRSPEED_TYPE m_airspeedType;
GPS_SETTING m_gpsSetting;
GPS_TYPE m_gpsType;
RADIO_SETTING m_radioSetting;
bool m_calibrationPerformed;

View File

@ -20,6 +20,7 @@ HEADERS += setupwizardplugin.h \
pages/multipage.h \
pages/fixedwingpage.h \
pages/airspeedpage.h \
pages/gpspage.h \
pages/helipage.h \
pages/surfacepage.h \
pages/abstractwizardpage.h \
@ -51,6 +52,7 @@ SOURCES += setupwizardplugin.cpp \
pages/multipage.cpp \
pages/fixedwingpage.cpp \
pages/airspeedpage.cpp \
pages/gpspage.cpp \
pages/helipage.cpp \
pages/surfacepage.cpp \
pages/abstractwizardpage.cpp \

View File

@ -65,7 +65,7 @@ public:
enum SERVO_TYPE { SERVO_ANALOG, SERVO_DIGITAL, SERVO_UNKNOWN };
enum INPUT_TYPE { INPUT_PWM, INPUT_PPM, INPUT_SBUS, INPUT_DSMX10, INPUT_DSMX11, INPUT_DSM2, INPUT_UNKNOWN };
enum AIRSPEED_TYPE { ESTIMATE, EAGLETREE, MS4525 };
enum GPS_SETTING { GPS_PLAT, GPS_UBX, GPS_NMEA, GPS_DISABLED };
enum GPS_TYPE { GPS_PLAT, GPS_UBX, GPS_NMEA, GPS_DISABLED };
enum RADIO_SETTING { RADIO_TELEMETRY, RADIO_DISABLED };
virtual VehicleConfigurationSource::CONTROLLER_TYPE getControllerType() const = 0;
@ -75,7 +75,7 @@ public:
virtual VehicleConfigurationSource::ESC_TYPE getEscType() const = 0;
virtual VehicleConfigurationSource::SERVO_TYPE getServoType() const = 0;
virtual VehicleConfigurationSource::AIRSPEED_TYPE getAirspeedType() const = 0;
virtual VehicleConfigurationSource::GPS_SETTING getGPSSetting() const = 0;
virtual VehicleConfigurationSource::GPS_TYPE getGpsType() const = 0;
virtual VehicleConfigurationSource::RADIO_SETTING getRadioSetting() const = 0;
virtual bool isCalibrationPerformed() const = 0;