LP-72 Sparky2 Wizard: Move Hott and ExBus to ReceiverPort
[librepilot.git] / ground / gcs / src / plugins / setupwizard / pages / gpspage.cpp
blob3f6c4295b5211b410cc331152f415c14f7e231f3
1 /**
2 ******************************************************************************
4 * @file fixedwingpage.cpp
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
6 * @addtogroup
7 * @{
8 * @addtogroup FixedWingPage
9 * @{
10 * @brief
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "gpspage.h"
29 #include "setupwizard.h"
31 GpsPage::GpsPage(SetupWizard *wizard, QWidget *parent) :
32 SelectionPage(wizard, QString(":/setupwizard/resources/sensor-shapes.svg"), parent)
35 GpsPage::~GpsPage()
38 void GpsPage::initializePage(VehicleConfigurationSource *settings)
40 // Enable all
41 setItemDisabled(-1, false);
43 bool isSparky = (getWizard()->getControllerType() == SetupWizard::CONTROLLER_SPARKY2);
44 // All rcinputs are on rcvrport for sparky2, that leaves mainport/flexiport available for gps/auxmag
45 if (!isSparky && (settings->getInputType() == VehicleConfigurationSource::INPUT_SBUS ||
46 settings->getInputType() == VehicleConfigurationSource::INPUT_DSM ||
47 settings->getInputType() == VehicleConfigurationSource::INPUT_SRXL ||
48 settings->getInputType() == VehicleConfigurationSource::INPUT_HOTT_SUMD ||
49 settings->getInputType() == VehicleConfigurationSource::INPUT_EXBUS)) {
50 // Disable GPS+I2C Mag
51 setItemDisabled(VehicleConfigurationSource::GPS_UBX_FLEXI_I2CMAG, true);
52 if (getSelectedItem()->id() == VehicleConfigurationSource::GPS_UBX_FLEXI_I2CMAG) {
53 // If previously selected invalid GPS, reset to no GPS
54 setSelectedItem(VehicleConfigurationSource::GPS_DISABLED);
59 bool GpsPage::validatePage(SelectionItem *selectedItem)
61 getWizard()->setGpsType((SetupWizard::GPS_TYPE)selectedItem->id());
62 if (getWizard()->getGpsType() == SetupWizard::GPS_DISABLED) {
63 getWizard()->setAirspeedType(VehicleConfigurationSource::AIRSPEED_DISABLED);
65 return true;
68 void GpsPage::setupSelection(Selection *selection)
70 selection->setTitle(tr("GPS Selection"));
71 selection->setText(tr("Please select the type of GPS you wish to use. As well as OpenPilot hardware, "
72 "3rd party GPSs are supported also, although please note that performance could "
73 "be less than optimal as not all GPSs are created equal.\n\n"
74 "Note: NMEA only GPSs perform poorly on VTOL aircraft and are not recommended for Helis and MultiRotors.\n\n"
75 "Please select your GPS type data below:"));
77 selection->addItem(tr("Disabled"),
78 tr("GPS Features are not to be enabled"),
79 "no-gps",
80 SetupWizard::GPS_DISABLED);
82 selection->addItem(tr("OpenPilot Platinum"),
83 tr("Select this option to use the OpenPilot Platinum GPS with integrated Magnetometer "
84 "and Microcontroller.\n\n"
85 "Note: for the OpenPilot v8 GPS please select the U-Blox option."),
86 "OPGPS-v9",
87 SetupWizard::GPS_PLATINUM);
89 selection->addItem(tr("Naza GPS"),
90 tr("Select this option to use the Naza GPS with integrated Magnetometer."),
91 "NazaGPS",
92 SetupWizard::GPS_NAZA);
94 selection->addItem(tr("U-Blox Based + Magnetometer"),
95 tr("Select this option for the generic U-Blox chipset based GPS + I2C Magnetometer.\n\n"
96 "GPS is connected to MainPort and two wires I2C to FlexiPort."),
97 "generic-ublox-mag",
98 SetupWizard::GPS_UBX_FLEXI_I2CMAG);
100 selection->addItem(tr("U-Blox Based"),
101 tr("Select this option for the OpenPilot V8 GPS or generic U-Blox chipset based GPS."),
102 "OPGPS-v8-ublox",
103 SetupWizard::GPS_UBX);
105 selection->addItem(tr("NMEA Based"),
106 tr("Select this option for a generic NMEA based GPS."),
107 "generic-nmea",
108 SetupWizard::GPS_NMEA);