2 ******************************************************************************
4 * @file fixedwingpage.cpp
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
8 * @addtogroup FixedWingPage
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
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
29 #include "setupwizard.h"
31 GpsPage::GpsPage(SetupWizard
*wizard
, QWidget
*parent
) :
32 SelectionPage(wizard
, QString(":/setupwizard/resources/sensor-shapes.svg"), parent
)
38 void GpsPage::initializePage(VehicleConfigurationSource
*settings
)
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_IBUS
||
50 settings
->getInputType() == VehicleConfigurationSource::INPUT_EXBUS
)) {
51 // Disable GPS+I2C Mag
52 setItemDisabled(VehicleConfigurationSource::GPS_UBX_FLEXI_I2CMAG
, true);
53 if (getSelectedItem()->id() == VehicleConfigurationSource::GPS_UBX_FLEXI_I2CMAG
) {
54 // If previously selected invalid GPS, reset to no GPS
55 setSelectedItem(VehicleConfigurationSource::GPS_DISABLED
);
60 bool GpsPage::validatePage(SelectionItem
*selectedItem
)
62 getWizard()->setGpsType((SetupWizard::GPS_TYPE
)selectedItem
->id());
63 if (getWizard()->getGpsType() == SetupWizard::GPS_DISABLED
) {
64 getWizard()->setAirspeedType(VehicleConfigurationSource::AIRSPEED_DISABLED
);
69 void GpsPage::setupSelection(Selection
*selection
)
71 selection
->setTitle(tr("GPS Selection"));
72 selection
->setText(tr("Please select the type of GPS you wish to use. As well as OpenPilot hardware, "
73 "3rd party GPSs are supported also, although please note that performance could "
74 "be less than optimal as not all GPSs are created equal.\n\n"
75 "Note: NMEA only GPSs perform poorly on VTOL aircraft and are not recommended for Helis and MultiRotors.\n\n"
76 "Please select your GPS type data below:"));
78 selection
->addItem(tr("Disabled"),
79 tr("GPS Features are not to be enabled"),
81 SetupWizard::GPS_DISABLED
);
83 selection
->addItem(tr("OpenPilot Platinum"),
84 tr("Select this option to use the OpenPilot Platinum GPS with integrated Magnetometer "
85 "and Microcontroller.\n\n"
86 "Note: for the OpenPilot v8 GPS please select the U-Blox option."),
88 SetupWizard::GPS_PLATINUM
);
90 selection
->addItem(tr("Naza GPS"),
91 tr("Select this option to use the Naza GPS with integrated Magnetometer."),
93 SetupWizard::GPS_NAZA
);
95 selection
->addItem(tr("U-Blox Based + Magnetometer"),
96 tr("Select this option for the generic U-Blox chipset based GPS + I2C Magnetometer.\n\n"
97 "GPS is connected to MainPort and two wires I2C to FlexiPort."),
99 SetupWizard::GPS_UBX_FLEXI_I2CMAG
);
101 selection
->addItem(tr("U-Blox Based"),
102 tr("Select this option for the OpenPilot V8 GPS or generic U-Blox chipset based GPS."),
104 SetupWizard::GPS_UBX
);
106 selection
->addItem(tr("NMEA Based"),
107 tr("Select this option for a generic NMEA based GPS."),
109 SetupWizard::GPS_NMEA
);