diff --git a/Makefile b/Makefile index 78738c1ef..a2d3d10f7 100644 --- a/Makefile +++ b/Makefile @@ -954,7 +954,7 @@ install: $(V1) $(MKDIR) -p $(DESTDIR)$(datadir)/applications $(V1) $(MKDIR) -p $(DESTDIR)$(datadir)/pixmaps $(V1) $(MKDIR) -p $(DESTDIR)$(udevdir) - $(V1) $(INSTALL) $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)/bin/openpilotgcs.bin $(DESTDIR)$(bindir)/openpilot-gcs + $(V1) $(INSTALL) $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)/bin/openpilotgcs $(DESTDIR)$(bindir) $(V1) $(INSTALL) $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)/bin/udp_test $(DESTDIR)$(bindir) $(V1) $(INSTALL) $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)/lib/openpilotgcs $(DESTDIR)$(libdir) $(V1) $(INSTALL) $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)/share/openpilotgcs $(DESTDIR)$(datadir) diff --git a/flight/pios/stm32f10x/pios_dsm.c b/flight/pios/stm32f10x/pios_dsm.c index 5fa1fb7ff..577e22949 100644 --- a/flight/pios/stm32f10x/pios_dsm.c +++ b/flight/pios/stm32f10x/pios_dsm.c @@ -213,12 +213,24 @@ static int PIOS_DSM_UnrollChannels(struct pios_dsm_dev *dsm_dev) /* extract and save the channel value */ uint8_t channel_num = (word >> resolution) & 0x0f; if (channel_num < PIOS_DSM_NUM_INPUTS) { + if (channel_log & (1 << channel_num)) { - /* Found duplicate! */ - /* Update resolution and restart processing the current frame. */ + /* Found duplicate. This should happen when in 11 bit */ + /* mode and the data is 10 bits */ + if (resolution == 10) + return -1; resolution = 10; return PIOS_DSM_UnrollChannels(dsm_dev); } + + if ((channel_log & 0xFF) == 0x55) { + /* This pattern indicates 10 bit pattern */ + if (resolution == 11) + return -1; + resolution = 11; + return PIOS_DSM_UnrollChannels(dsm_dev); + } + state->channel_data[channel_num] = (word & mask); /* keep track of this channel */ channel_log |= (1 << channel_num); diff --git a/flight/pios/stm32f4xx/pios_dsm.c b/flight/pios/stm32f4xx/pios_dsm.c index 4154f9f23..314102c0e 100644 --- a/flight/pios/stm32f4xx/pios_dsm.c +++ b/flight/pios/stm32f4xx/pios_dsm.c @@ -215,12 +215,24 @@ static int PIOS_DSM_UnrollChannels(struct pios_dsm_dev *dsm_dev) /* extract and save the channel value */ uint8_t channel_num = (word >> resolution) & 0x0f; if (channel_num < PIOS_DSM_NUM_INPUTS) { + if (channel_log & (1 << channel_num)) { - /* Found duplicate! */ - /* Update resolution and restart processing the current frame. */ + /* Found duplicate. This should happen when in 11 bit */ + /* mode and the data is 10 bits */ + if (resolution == 10) + return -1; resolution = 10; return PIOS_DSM_UnrollChannels(dsm_dev); } + + if ((channel_log & 0xFF) == 0x55) { + /* This pattern indicates 10 bit pattern */ + if (resolution == 11) + return -1; + resolution = 11; + return PIOS_DSM_UnrollChannels(dsm_dev); + } + state->channel_data[channel_num] = (word & mask); /* keep track of this channel */ channel_log |= (1 << channel_num); diff --git a/ground/openpilotgcs/bin/bin.pro b/ground/openpilotgcs/bin/bin.pro deleted file mode 100644 index c8df2097d..000000000 --- a/ground/openpilotgcs/bin/bin.pro +++ /dev/null @@ -1,14 +0,0 @@ -include(../openpilotgcs.pri) - -TEMPLATE = app -TARGET = $$GCS_APP_WRAPPER -OBJECTS_DIR = - -PRE_TARGETDEPS = $$PWD/openpilotgcs - -QMAKE_LINK = cp $$PWD/openpilotgcs $@ && : IGNORE REST - -QMAKE_CLEAN = $$GCS_APP_WRAPPER - -target.path = /bin -INSTALLS += target diff --git a/ground/openpilotgcs/bin/openpilotgcs b/ground/openpilotgcs/bin/openpilotgcs deleted file mode 100755 index 14ff21462..000000000 --- a/ground/openpilotgcs/bin/openpilotgcs +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -makeAbsolute() { - case "$1" in - /*) - # already absolute, return it - echo "$1" - ;; - *) - # relative, prepend $2 made absolute - echo `makeAbsolute "$2" "$PWD"`/"$1" | sed 's,/\.$,,' - ;; - esac -} - -if test -L "$0"; then - # Try readlink(1) - readlink=`type readlink 2>/dev/null` || readlink= - if test -n "$readlink"; then - # We have readlink(1), so we can use it - me=`readlink -nf "$0"` - else - # No readlink(1), so let's try ls -l - me=`ls -l "$0" | sed 's/^.*-> //'` - base=`dirname "$0"` - me=`makeAbsolute "$me" "$base"` - fi -else - me="$0" -fi - -bindir=`dirname "$me"` -libdir=`cd "${bindir}/../lib" ; pwd` -LD_LIBRARY_PATH="${libdir}/openpilotgcs:${LD_LIBRARY_PATH}" -export LD_LIBRARY_PATH -exec "${bindir}/openpilotgcs.bin" ${1+"$@"} diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index 40721f15d..1961dc163 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -31,9 +31,9 @@ GCS_LIBRARY_PATH libQt5DBus.so.5 \ libQt5QuickParticles.so.5 \ libqgsttools_p.so.1 \ - libicui18n.so.52 \ - libicuuc.so.52 \ - libicudata.so.52 + libicui18n.so.53 \ + libicuuc.so.53 \ + libicudata.so.53 data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_QT_LIBRARY_PATH\") $$addNewline() for(lib, QT_LIBS) { @@ -142,9 +142,9 @@ GCS_LIBRARY_PATH Qt5MultimediaWidgets$${DS}.dll \ Qt5Quick$${DS}.dll \ Qt5Qml$${DS}.dll \ - icuin52.dll \ - icudt52.dll \ - icuuc52.dll + icuin53.dll \ + icudt53.dll \ + icuuc53.dll # it is more robust to take the following DLLs from Qt rather than from MinGW QT_DLLS += libgcc_s_dw2-1.dll \ libstdc++-6.dll \ diff --git a/ground/openpilotgcs/openpilotgcs.pri b/ground/openpilotgcs/openpilotgcs.pri index ea1481589..943dac262 100644 --- a/ground/openpilotgcs/openpilotgcs.pri +++ b/ground/openpilotgcs/openpilotgcs.pri @@ -111,8 +111,7 @@ macx { GCS_APP_TARGET = openpilotgcs copyqt = $$copydata } else { - GCS_APP_WRAPPER = openpilotgcs - GCS_APP_TARGET = openpilotgcs.bin + GCS_APP_TARGET = openpilotgcs GCS_QT_LIBRARY_PATH = $$GCS_BUILD_TREE/$$GCS_LIBRARY_BASENAME/qt5 GCS_QT_PLUGINS_PATH = $$GCS_BUILD_TREE/$$GCS_LIBRARY_BASENAME/qt5/plugins GCS_QT_QML_PATH = $$GCS_BUILD_TREE/$$GCS_LIBRARY_BASENAME/qt5/qml diff --git a/ground/openpilotgcs/openpilotgcs.pro b/ground/openpilotgcs/openpilotgcs.pro index 54f62cc47..beedddc3c 100644 --- a/ground/openpilotgcs/openpilotgcs.pro +++ b/ground/openpilotgcs/openpilotgcs.pro @@ -5,14 +5,14 @@ cache() -#check Qt version +# check Qt version QT_VERSION = $$[QT_VERSION] QT_VERSION = $$split(QT_VERSION, ".") QT_VER_MAJ = $$member(QT_VERSION, 0) QT_VER_MIN = $$member(QT_VERSION, 1) -lessThan(QT_VER_MAJ, 5) | lessThan(QT_VER_MIN, 1) { - error(OpenPilot GCS requires Qt 5.1.0 or newer but Qt $$[QT_VERSION] was detected.) +lessThan(QT_VER_MAJ, 5) | lessThan(QT_VER_MIN, 4) { + error(OpenPilot GCS requires Qt 5.4.0 or newer but Qt $$[QT_VERSION] was detected.) } macx { @@ -32,6 +32,5 @@ CONFIG += ordered DEFINES += USE_PATHPLANNER SUBDIRS = src share copydata -unix:!macx:!isEmpty(copydata):SUBDIRS += bin copydata.file = copydata.pro diff --git a/ground/openpilotgcs/share/openpilotgcs/stylesheets/default.qss b/ground/openpilotgcs/share/openpilotgcs/stylesheets/default.qss index 873b2f7de..44320b285 100644 --- a/ground/openpilotgcs/share/openpilotgcs/stylesheets/default.qss +++ b/ground/openpilotgcs/share/openpilotgcs/stylesheets/default.qss @@ -7,13 +7,12 @@ MyListWidget { Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255)); } - + QSlider::groove:horizontal { border: 1px solid rgb(196, 196, 196); background: white; height: 6px; border-radius: 2px; - margin 10px 10px; } QSlider::add-page:horizontal { @@ -110,3 +109,5 @@ QSlider::handle:horizontal:hover { border: 1px solid #444; border-radius: 4px; } + + diff --git a/ground/openpilotgcs/src/app/app.pro b/ground/openpilotgcs/src/app/app.pro index 8e0402565..598201b2b 100644 --- a/ground/openpilotgcs/src/app/app.pro +++ b/ground/openpilotgcs/src/app/app.pro @@ -10,7 +10,6 @@ QT += xml widgets SOURCES += main.cpp \ gcssplashscreen.cpp -include(../rpath.pri) include(../libs/utils/utils.pri) include(../libs/version_info/version_info.pri) @@ -27,9 +26,13 @@ win32 { FILETYPES.files = profile.icns prifile.icns FILETYPES.path = Contents/Resources QMAKE_BUNDLE_DATA += FILETYPES + QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Plugins/ } else { target.path = /bin INSTALLS += target + QMAKE_RPATHDIR = \'\$$ORIGIN\'/$$relative_path($$GCS_LIBRARY_PATH, $$GCS_APP_PATH) + QMAKE_RPATHDIR += \'\$$ORIGIN\'/$$relative_path($$GCS_QT_LIBRARY_PATH, $$GCS_APP_PATH) + include(../rpath.pri) } OTHER_FILES += openpilotgcs.rc diff --git a/ground/openpilotgcs/src/libs/utils/logfile.h b/ground/openpilotgcs/src/libs/utils/logfile.h index 26e0f86ca..0f84ad5d8 100644 --- a/ground/openpilotgcs/src/libs/utils/logfile.h +++ b/ground/openpilotgcs/src/libs/utils/logfile.h @@ -15,7 +15,7 @@ class QTCREATOR_UTILS_EXPORT LogFile : public QIODevice { public: explicit LogFile(QObject *parent = 0); qint64 bytesAvailable() const; - qint64 bytesToWrite() + qint64 bytesToWrite() const { return m_file.bytesToWrite(); }; diff --git a/ground/openpilotgcs/src/openpilotgcslibrary.pri b/ground/openpilotgcs/src/openpilotgcslibrary.pri index d98860827..59791944d 100644 --- a/ground/openpilotgcs/src/openpilotgcslibrary.pri +++ b/ground/openpilotgcs/src/openpilotgcslibrary.pri @@ -6,17 +6,21 @@ win32 { DESTDIR = $$GCS_LIBRARY_PATH -include(rpath.pri) - TARGET = $$qtLibraryName($$TARGET) contains(QT_CONFIG, reduce_exports):CONFIG += hGCS_symbols -!macx { +macx { + QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Plugins/ +} else win32 { target.path = /bin target.files = $$DESTDIR/$${TARGET}.dll } else { + QMAKE_RPATHDIR = \'\$$ORIGIN\' + QMAKE_RPATHDIR += \'\$$ORIGIN\'/$$relative_path($$GCS_QT_LIBRARY_PATH, $$GCS_LIBRARY_PATH) + include(rpath.pri) + target.path = /$$GCS_LIBRARY_BASENAME/openpilotgcs } INSTALLS += target diff --git a/ground/openpilotgcs/src/openpilotgcsplugin.pri b/ground/openpilotgcs/src/openpilotgcsplugin.pri index 9276f1832..2a01ffcc3 100644 --- a/ground/openpilotgcs/src/openpilotgcsplugin.pri +++ b/ground/openpilotgcs/src/openpilotgcsplugin.pri @@ -30,13 +30,10 @@ TARGET = $$qtLibraryName($$TARGET) macx { QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Plugins/$${PROVIDER}/ } else:linux-* { - #do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR - QMAKE_RPATHDIR = \$\$ORIGIN - QMAKE_RPATHDIR += \$\$ORIGIN/.. - QMAKE_RPATHDIR += \$\$ORIGIN/../.. - GCS_PLUGIN_RPATH = $$join(QMAKE_RPATHDIR, ":") - QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,$${GCS_PLUGIN_RPATH}\' - QMAKE_RPATHDIR = + QMAKE_RPATHDIR = \'\$$ORIGIN\' + QMAKE_RPATHDIR += \'\$$ORIGIN\'/$$relative_path($$GCS_LIBRARY_PATH, $$DESTDIR) + QMAKE_RPATHDIR += \'\$$ORIGIN\'/$$relative_path($$GCS_QT_LIBRARY_PATH, $$DESTDIR) + include(rpath.pri) } diff --git a/ground/openpilotgcs/src/plugins/config/configgadget.qrc b/ground/openpilotgcs/src/plugins/config/configgadget.qrc index c557e7b81..01984a553 100644 --- a/ground/openpilotgcs/src/plugins/config/configgadget.qrc +++ b/ground/openpilotgcs/src/plugins/config/configgadget.qrc @@ -1,5 +1,11 @@ <RCC> <qresource prefix="/configgadget"> + <file>images/flightmode_bg1.png</file> + <file>images/flightmode_bg2.png</file> + <file>images/flightmode_bg3.png</file> + <file>images/flightmode_bg4.png</file> + <file>images/flightmode_bg5.png</file> + <file>images/flightmode_bg6.png</file> <file>images/help2.png</file> <file>images/ahrs-calib.svg</file> <file>images/multirotor-shapes.svg</file> diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp index 3ca726523..d7b9fd7d0 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp @@ -71,6 +71,7 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : accessoryDesiredObj0 = AccessoryDesired::GetInstance(getObjectManager(), 0); accessoryDesiredObj1 = AccessoryDesired::GetInstance(getObjectManager(), 1); accessoryDesiredObj2 = AccessoryDesired::GetInstance(getObjectManager(), 2); + actuatorSettingsObj = ActuatorSettings::GetInstance(getObjectManager()); // Only instance 0 is present if the board is not connected. // The other instances are populated lazily. @@ -96,6 +97,7 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : Q_ASSERT(index < ManualControlSettings::CHANNELGROUPS_NUMELEM); InputChannelForm *form = new InputChannelForm(index, this); form->setName(name); + form->moveTo(*(ui->channelLayout)); // The order of the following binding calls is important. Since the values will be populated @@ -104,7 +106,9 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : // will not be set correctly. addWidgetBinding("ManualControlSettings", "ChannelNumber", form->ui->channelNumber, index); addWidgetBinding("ManualControlSettings", "ChannelGroups", form->ui->channelGroup, index); - addWidgetBinding("ManualControlSettings", "ChannelNeutral", form->ui->channelNeutral, index); + // Slider position based on real time Rcinput (allow monitoring) + addWidgetBinding("ManualControlCommand", "Channel", form->ui->channelNeutral, index); + // Neutral value stored on board (SpinBox) addWidgetBinding("ManualControlSettings", "ChannelNeutral", form->ui->neutralValue, index); addWidgetBinding("ManualControlSettings", "ChannelMax", form->ui->channelMax, index); addWidgetBinding("ManualControlSettings", "ChannelMin", form->ui->channelMin, index); @@ -408,6 +412,13 @@ void ConfigInputWidget::goToWizard() previousFlightModeSettingsData = flightModeSettingsData; flightModeSettingsData.Arming = FlightModeSettings::ARMING_ALWAYSDISARMED; flightModeSettingsObj->setData(flightModeSettingsData); + // Stash actuatorSettings + actuatorSettingsData = actuatorSettingsObj->getData(); + previousActuatorSettingsData = actuatorSettingsData; + + // Now reset channel and actuator settings (disable outputs) + resetChannelSettings(); + resetActuatorSettings(); // Use faster input update rate. fastMdata(); @@ -447,6 +458,7 @@ void ConfigInputWidget::wzCancel() // Load settings back from beginning of wizard manualSettingsObj->setData(previousManualSettingsData); flightModeSettingsObj->setData(previousFlightModeSettingsData); + actuatorSettingsObj->setData(previousActuatorSettingsData); } void ConfigInputWidget::registerControlActivity() @@ -528,13 +540,16 @@ void ConfigInputWidget::wzNext() // Restore original input update rate. restoreMdata(); + // Load actuator settings back from beginning of wizard + actuatorSettingsObj->setData(previousActuatorSettingsData); + // Leave setting the throttle neutral until the final Next press, // else the throttle scaling causes the graphical stick movement to not // match the tx stick manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_THROTTLE] = manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE] + ((manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_THROTTLE] - - manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE]) * 0.02); + manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE]) * 0.04); if ((abs(manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_FLIGHTMODE] - manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_FLIGHTMODE]) < 100) || (abs(manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_FLIGHTMODE] - @@ -1533,6 +1548,26 @@ void ConfigInputWidget::updatePositionSlider() default: break; } + + QString fmNumber = QString().setNum(manualSettingsDataPriv.FlightModeNumber); + int count = 0; + foreach(QSlider * sp, findChildren<QSlider *>()) { + // Find FlightMode slider and apply stylesheet + if (sp->objectName() == "channelNeutral") { + if (count == 4) { + sp->setStyleSheet( + "QSlider::groove:horizontal {border: 2px solid rgb(196, 196, 196); height: 12px; border-radius: 4px; " + "border-image:url(:/configgadget/images/flightmode_bg" + fmNumber + ".png); }" + "QSlider::add-page:horizontal { background: none; border: none; }" + "QSlider::sub-page:horizontal { background: none; border: none; }" + "QSlider::handle:horizontal { background: rgba(196, 196, 196, 255); width: 10px; height: 28px; " + "margin: -3px -2px; border-radius: 3px; border: 1px solid #777; }"); + count++; + } else { + count++; + } + } + } } void ConfigInputWidget::updateCalibration() @@ -1547,7 +1582,11 @@ void ConfigInputWidget::updateCalibration() (reverse[i] && manualSettingsData.ChannelMax[i] > manualCommandData.Channel[i])) { manualSettingsData.ChannelMax[i] = manualCommandData.Channel[i]; } - manualSettingsData.ChannelNeutral[i] = manualCommandData.Channel[i]; + if (i == ManualControlSettings::CHANNELNUMBER_FLIGHTMODE || i == ManualControlSettings::CHANNELNUMBER_FLIGHTMODE) { + adjustSpecialNeutrals(); + } else { + manualSettingsData.ChannelNeutral[i] = manualCommandData.Channel[i]; + } } manualSettingsObj->setData(manualSettingsData); @@ -1558,10 +1597,15 @@ void ConfigInputWidget::simpleCalibration(bool enable) { if (enable) { ui->configurationWizard->setEnabled(false); + ui->saveRCInputToRAM->setEnabled(false); + ui->saveRCInputToSD->setEnabled(false); + ui->runCalibration->setText(tr("Stop Manual Calibration")); QMessageBox msgBox; - msgBox.setText(tr("Arming Settings are now set to 'Always Disarmed' for your safety.")); - msgBox.setDetailedText(tr("You will have to reconfigure the arming settings manually when the wizard is finished.")); + msgBox.setText(tr("<p>Arming Settings are now set to 'Always Disarmed' for your safety.</p>" + "<p>Be sure your receiver is powered with an external source and Transmitter is on.</p>" + "<p align='center'><b>Stop Manual Calibration</b> when done</p>")); + msgBox.setDetailedText(tr("You will have to reconfigure the arming settings manually when the manual calibration is finished.")); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); msgBox.exec(); @@ -1582,9 +1626,19 @@ void ConfigInputWidget::simpleCalibration(bool enable) fastMdataSingle(manualCommandObj, &manualControlMdata); + // Stash actuatorSettings + actuatorSettingsData = actuatorSettingsObj->getData(); + previousActuatorSettingsData = actuatorSettingsData; + + // Disable all actuators + resetActuatorSettings(); + connect(manualCommandObj, SIGNAL(objectUnpacked(UAVObject *)), this, SLOT(updateCalibration())); } else { ui->configurationWizard->setEnabled(true); + ui->saveRCInputToRAM->setEnabled(true); + ui->saveRCInputToSD->setEnabled(true); + ui->runCalibration->setText(tr("Start Manual Calibration")); manualCommandData = manualCommandObj->getData(); manualSettingsData = manualSettingsObj->getData(); @@ -1592,22 +1646,64 @@ void ConfigInputWidget::simpleCalibration(bool enable) restoreMdataSingle(manualCommandObj, &manualControlMdata); for (unsigned int i = 0; i < ManualControlCommand::CHANNEL_NUMELEM; i++) { - manualSettingsData.ChannelNeutral[i] = manualCommandData.Channel[i]; + if (i == ManualControlSettings::CHANNELNUMBER_FLIGHTMODE || i == ManualControlSettings::CHANNELNUMBER_FLIGHTMODE) { + adjustSpecialNeutrals(); + } else { + manualSettingsData.ChannelNeutral[i] = manualCommandData.Channel[i]; + } } - // Force flight mode neutral to middle - manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNUMBER_FLIGHTMODE] = - (manualSettingsData.ChannelMax[ManualControlSettings::CHANNELNUMBER_FLIGHTMODE] + - manualSettingsData.ChannelMin[ManualControlSettings::CHANNELNUMBER_FLIGHTMODE]) / 2; - - // Force throttle to be near min - manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_THROTTLE] = - manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE] + - ((manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_THROTTLE] - - manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE]) * 0.02); - manualSettingsObj->setData(manualSettingsData); + // Load actuator settings back from beginning of manual calibration + actuatorSettingsObj->setData(previousActuatorSettingsData); + disconnect(manualCommandObj, SIGNAL(objectUnpacked(UAVObject *)), this, SLOT(updateCalibration())); } } + +void ConfigInputWidget::adjustSpecialNeutrals() +{ + // FlightMode and Throttle need special neutral settings + // + // Force flight mode neutral to middle + manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNUMBER_FLIGHTMODE] = + (manualSettingsData.ChannelMax[ManualControlSettings::CHANNELNUMBER_FLIGHTMODE] + + manualSettingsData.ChannelMin[ManualControlSettings::CHANNELNUMBER_FLIGHTMODE]) / 2; + + // Force throttle to be near min, add 4% from total range to avoid arming issues + manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_THROTTLE] = + manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE] + + ((manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_THROTTLE] - + manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE]) * 0.04); +} + +bool ConfigInputWidget::shouldObjectBeSaved(UAVObject *object) +{ + // ManualControlCommand no need to be saved + return dynamic_cast<ManualControlCommand *>(object) == NULL; +} + +void ConfigInputWidget::resetChannelSettings() +{ + manualSettingsData = manualSettingsObj->getData(); + // Clear all channel data : Channel Type (PPM,PWM..) and Number + for (unsigned int channel = 0; channel < 9; channel++) { + manualSettingsData.ChannelGroups[channel] = ManualControlSettings::CHANNELGROUPS_NONE; + manualSettingsData.ChannelNumber[channel] = 0; + manualSettingsObj->setData(manualSettingsData); + } +} + +void ConfigInputWidget::resetActuatorSettings() +{ + actuatorSettingsData = actuatorSettingsObj->getData(); + // Clear all output data : Min, max, neutral = 1500 + // 1500 = servo middle, can be applied to all outputs because board is 'Alwaysdisarmed' + for (unsigned int output = 0; output < 12; output++) { + actuatorSettingsData.ChannelMax[output] = 1500; + actuatorSettingsData.ChannelMin[output] = 1500; + actuatorSettingsData.ChannelNeutral[output] = 1500; + actuatorSettingsObj->setData(actuatorSettingsData); + } +} diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.h b/ground/openpilotgcs/src/plugins/config/configinputwidget.h index 636c5088b..913d55f70 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.h @@ -39,6 +39,7 @@ #include <QRadioButton> #include "manualcontrolcommand.h" #include "manualcontrolsettings.h" +#include "actuatorsettings.h" #include "flightmodesettings.h" #include "receiveractivity.h" #include <QGraphicsView> @@ -65,6 +66,7 @@ public: goToWizard(); } void enableControls(bool enable); + bool shouldObjectBeSaved(UAVObject *object); private: bool growing; @@ -121,6 +123,10 @@ private: ManualControlSettings::DataFields manualSettingsData; ManualControlSettings::DataFields previousManualSettingsData; + ActuatorSettings *actuatorSettingsObj; + ActuatorSettings::DataFields actuatorSettingsData; + ActuatorSettings::DataFields previousActuatorSettingsData; + FlightModeSettings *flightModeSettingsObj; FlightModeSettings::DataFields flightModeSettingsData; FlightModeSettings::DataFields previousFlightModeSettingsData; @@ -188,7 +194,10 @@ private slots: void updatePositionSlider(); void invertControls(); void simpleCalibration(bool state); + void adjustSpecialNeutrals(); void updateCalibration(); + void resetChannelSettings(); + void resetActuatorSettings(); protected: void resizeEvent(QResizeEvent *event); diff --git a/ground/openpilotgcs/src/plugins/config/images/flightmode_bg1.png b/ground/openpilotgcs/src/plugins/config/images/flightmode_bg1.png new file mode 100644 index 000000000..ae77ac436 Binary files /dev/null and b/ground/openpilotgcs/src/plugins/config/images/flightmode_bg1.png differ diff --git a/ground/openpilotgcs/src/plugins/config/images/flightmode_bg2.png b/ground/openpilotgcs/src/plugins/config/images/flightmode_bg2.png new file mode 100644 index 000000000..8008aa805 Binary files /dev/null and b/ground/openpilotgcs/src/plugins/config/images/flightmode_bg2.png differ diff --git a/ground/openpilotgcs/src/plugins/config/images/flightmode_bg3.png b/ground/openpilotgcs/src/plugins/config/images/flightmode_bg3.png new file mode 100644 index 000000000..4791cab01 Binary files /dev/null and b/ground/openpilotgcs/src/plugins/config/images/flightmode_bg3.png differ diff --git a/ground/openpilotgcs/src/plugins/config/images/flightmode_bg4.png b/ground/openpilotgcs/src/plugins/config/images/flightmode_bg4.png new file mode 100644 index 000000000..288469102 Binary files /dev/null and b/ground/openpilotgcs/src/plugins/config/images/flightmode_bg4.png differ diff --git a/ground/openpilotgcs/src/plugins/config/images/flightmode_bg5.png b/ground/openpilotgcs/src/plugins/config/images/flightmode_bg5.png new file mode 100644 index 000000000..e60bad1ad Binary files /dev/null and b/ground/openpilotgcs/src/plugins/config/images/flightmode_bg5.png differ diff --git a/ground/openpilotgcs/src/plugins/config/images/flightmode_bg6.png b/ground/openpilotgcs/src/plugins/config/images/flightmode_bg6.png new file mode 100644 index 000000000..05a095495 Binary files /dev/null and b/ground/openpilotgcs/src/plugins/config/images/flightmode_bg6.png differ diff --git a/ground/openpilotgcs/src/plugins/config/input.ui b/ground/openpilotgcs/src/plugins/config/input.ui index 4f4621d92..dbf637b81 100644 --- a/ground/openpilotgcs/src/plugins/config/input.ui +++ b/ground/openpilotgcs/src/plugins/config/input.ui @@ -116,8 +116,8 @@ <rect> <x>0</x> <y>0</y> - <width>772</width> - <height>514</height> + <width>774</width> + <height>497</height> </rect> </property> <layout class="QGridLayout" name="gridLayout"> @@ -419,7 +419,7 @@ <bool>false</bool> </property> <property name="text"> - <string>Manual Calibration</string> + <string>Start Manual Calibration</string> </property> <property name="checkable"> <bool>true</bool> @@ -542,8 +542,8 @@ <rect> <x>0</x> <y>0</y> - <width>724</width> - <height>497</height> + <width>730</width> + <height>554</height> </rect> </property> <layout class="QGridLayout" name="gridLayout_7" rowstretch="1,0,0,0"> @@ -2044,8 +2044,8 @@ Setup the flight mode channel on the RC Input tab if you have not done so alread <rect> <x>0</x> <y>0</y> - <width>407</width> - <height>138</height> + <width>544</width> + <height>169</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> diff --git a/ground/openpilotgcs/src/plugins/config/inputchannelform.cpp b/ground/openpilotgcs/src/plugins/config/inputchannelform.cpp index 8d5ff8c7f..7fb7714fa 100644 --- a/ground/openpilotgcs/src/plugins/config/inputchannelform.cpp +++ b/ground/openpilotgcs/src/plugins/config/inputchannelform.cpp @@ -12,6 +12,7 @@ InputChannelForm::InputChannelForm(const int index, QWidget *parent) : connect(ui->channelMin, SIGNAL(valueChanged(int)), this, SLOT(minMaxUpdated())); connect(ui->channelMax, SIGNAL(valueChanged(int)), this, SLOT(minMaxUpdated())); connect(ui->neutralValue, SIGNAL(valueChanged(int)), this, SLOT(neutralUpdated())); + connect(ui->channelNeutral, SIGNAL(valueChanged(int)), this, SLOT(updateTooltip())); connect(ui->channelGroup, SIGNAL(currentIndexChanged(int)), this, SLOT(groupUpdated())); connect(ui->channelRev, SIGNAL(toggled(bool)), this, SLOT(reversedUpdated())); @@ -53,6 +54,15 @@ void InputChannelForm::minMaxUpdated() ui->channelRev->setChecked(reverse); ui->channelNeutral->setInvertedAppearance(reverse); ui->channelNeutral->setInvertedControls(reverse); + + updateNeutralMark(); +} + +void InputChannelForm::updateTooltip() +{ + int currentValue = ui->channelNeutral->value(); + + ui->channelNeutral->setToolTip(QString::number(currentValue)); } void InputChannelForm::neutralUpdated() @@ -72,6 +82,30 @@ void InputChannelForm::neutralUpdated() ui->channelMax->setValue(neutralValue); } } + + updateNeutralMark(); +} + +void InputChannelForm::updateNeutralMark() +{ + // Add a small neutral red mark on groove background + int neutral = ui->neutralValue->value(); + int min = ui->channelMin->value(); + int max = ui->channelMax->value(); + + float range = max - min; + float offset = neutral - min; + float neutralPosition = offset / range; + + ui->channelNeutral->setStyleSheet( + "QSlider::groove:horizontal { border: 1px solid rgb(196, 196, 196); height: 6px; border-radius: 2px; " + "background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:" + QString::number(neutralPosition - 0.01) + " transparent, stop:" + + QString::number(neutralPosition) + " red, stop:" + QString::number(neutralPosition + 0.01) + " transparent); }" + "QSlider::add-page:horizontal { background: rgba(255,255,255,180); border: 1px solid #777; margin: 0px 0px 0px 2px; border-radius: 4px; }" + "QSlider::sub-page:horizontal { background: rgba(78,147,246,180); border: 1px solid #777; margin: 0px 2px 0px 0px; border-radius: 4px; }" + "QSlider::handle:horizontal { background: rgba(196,196,196,180); width: 18px; height: 28px; margin: -2px 0px; border-radius: 3px; " + "border: 1px solid #777; }" + ); } void InputChannelForm::reversedUpdated() diff --git a/ground/openpilotgcs/src/plugins/config/inputchannelform.h b/ground/openpilotgcs/src/plugins/config/inputchannelform.h index f48bcbd0a..7763e0d4b 100644 --- a/ground/openpilotgcs/src/plugins/config/inputchannelform.h +++ b/ground/openpilotgcs/src/plugins/config/inputchannelform.h @@ -23,6 +23,8 @@ public: virtual void setName(const QString &name); private slots: + void updateNeutralMark(); + void updateTooltip(); void minMaxUpdated(); void neutralUpdated(); void reversedUpdated(); diff --git a/ground/openpilotgcs/src/plugins/config/inputchannelform.ui b/ground/openpilotgcs/src/plugins/config/inputchannelform.ui index 0a3fc987e..156d653ac 100644 --- a/ground/openpilotgcs/src/plugins/config/inputchannelform.ui +++ b/ground/openpilotgcs/src/plugins/config/inputchannelform.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>923</width> - <height>51</height> + <height>57</height> </rect> </property> <property name="windowTitle"> @@ -215,7 +215,7 @@ margin:1px;</string> </property> </widget> </item> - <item row="1" column="9"> + <item row="1" column="11"> <widget class="QSpinBox" name="channelResponseTime"> <property name="enabled"> <bool>true</bool> @@ -311,7 +311,7 @@ margin:1px;</string> </property> </widget> </item> - <item row="0" column="7"> + <item row="0" column="9"> <spacer name="horizontalSpacer_4"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -343,7 +343,7 @@ margin:1px;</string> </property> </spacer> </item> - <item row="1" column="7"> + <item row="1" column="9"> <spacer name="horizontalSpacer_2"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -359,8 +359,8 @@ margin:1px;</string> </property> </spacer> </item> - <item row="0" column="8"> - <widget class="QLabel" name="legend6"> + <item row="0" column="10"> + <widget class="QLabel" name="legend7"> <property name="enabled"> <bool>true</bool> </property> @@ -408,8 +408,8 @@ margin:1px;</string> </property> </widget> </item> - <item row="0" column="9"> - <widget class="QLabel" name="legend7"> + <item row="0" column="11"> + <widget class="QLabel" name="legend8"> <property name="enabled"> <bool>true</bool> </property> @@ -457,8 +457,8 @@ margin:1px;</string> </property> </widget> </item> - <item row="0" column="6"> - <widget class="QLabel" name="legend5"> + <item row="0" column="8"> + <widget class="QLabel" name="legend6"> <property name="enabled"> <bool>true</bool> </property> @@ -506,52 +506,6 @@ margin:1px;</string> </property> </widget> </item> - <item row="0" column="5"> - <widget class="QLabel" name="legend4"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>20</height> - </size> - </property> - <property name="font"> - <font> - <pointsize>-1</pointsize> - <weight>75</weight> - <italic>false</italic> - <bold>true</bold> - </font> - </property> - <property name="toolTip"> - <string>Channel neutral</string> - </property> - <property name="styleSheet"> - <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -font: bold 12px; -margin:1px;</string> - </property> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="text"> - <string>Neutral</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> <item row="0" column="3"> <widget class="QLabel" name="legend3"> <property name="enabled"> @@ -644,7 +598,7 @@ margin:1px;</string> </property> </widget> </item> - <item row="1" column="6"> + <item row="1" column="8"> <widget class="QSpinBox" name="channelMax"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> @@ -684,105 +638,7 @@ margin:1px;</string> </property> </widget> </item> - <item row="1" column="5"> - <widget class="QFrame" name="frame"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>16777215</height> - </size> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="leftMargin"> - <number>2</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QSlider" name="channelNeutral"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="neutralValue"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>16777215</height> - </size> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="keyboardTracking"> - <bool>false</bool> - </property> - <property name="maximum"> - <number>9999</number> - </property> - <property name="value"> - <number>1000</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="1" column="8"> + <item row="1" column="10"> <widget class="QFrame" name="frame_1"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> @@ -846,6 +702,143 @@ margin:1px;</string> </layout> </widget> </item> + <item row="1" column="7"> + <widget class="QSpinBox" name="neutralValue"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="keyboardTracking"> + <bool>false</bool> + </property> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>1000</number> + </property> + </widget> + </item> + <item row="1" column="5"> + <widget class="QSlider" name="channelNeutral"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="accessibleName"> + <string/> + </property> + <property name="accessibleDescription"> + <string/> + </property> + <property name="inputMethodHints"> + <set>Qt::ImhNone</set> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBothSides</enum> + </property> + <property name="tickInterval"> + <number>50</number> + </property> + </widget> + </item> + <item row="0" column="5"> + <widget class="QLabel" name="legend4"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + <property name="font"> + <font> + <pointsize>-1</pointsize> + <weight>75</weight> + <italic>false</italic> + <bold>true</bold> + </font> + </property> + <property name="toolTip"> + <string>Channel value</string> + </property> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="text"> + <string>Channel Value</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="7"> + <widget class="QLabel" name="legend5"> + <property name="toolTip"> + <string>Channel neutral</string> + </property> + <property name="styleSheet"> + <string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px;</string> + </property> + <property name="text"> + <string>Neutral</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> </layout> </widget> <resources/> diff --git a/ground/openpilotgcs/src/plugins/coreplugin/iuavgadget.h b/ground/openpilotgcs/src/plugins/coreplugin/iuavgadget.h index eeeb1e8a5..46cd22146 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/iuavgadget.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/iuavgadget.h @@ -85,7 +85,7 @@ public slots: virtual void configurationChanged(IUAVGadgetConfiguration *) {} virtual void configurationAdded(IUAVGadgetConfiguration *) {} virtual void configurationToBeDeleted(IUAVGadgetConfiguration *) {} - virtual void configurationNameChanged(QString, QString) {} + virtual void configurationNameChanged(IUAVGadgetConfiguration *, QString, QString) {} private slots: private: QString m_classId; diff --git a/ground/openpilotgcs/src/plugins/coreplugin/iuavgadgetconfiguration.h b/ground/openpilotgcs/src/plugins/coreplugin/iuavgadgetconfiguration.h index 278987b12..3aed78a4d 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/iuavgadgetconfiguration.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/iuavgadgetconfiguration.h @@ -69,7 +69,7 @@ public: m_locked = locked; } - virtual void saveConfig(QSettings * /*settings*/) const {}; + virtual void saveConfig(QSettings * /*settings*/) const {} virtual void saveConfig(QSettings *settings, UAVConfigInfo * /*configInfo*/) const { saveConfig(settings); diff --git a/ground/openpilotgcs/src/plugins/coreplugin/uavconfiginfo.cpp b/ground/openpilotgcs/src/plugins/coreplugin/uavconfiginfo.cpp index 3716fe4b5..1678f3e90 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/uavconfiginfo.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/uavconfiginfo.cpp @@ -194,7 +194,7 @@ bool UAVConfigInfo::askToAbort(int compat, QString message) return true; default: - msgBox.setText("INTERNAL ERROR: " + message + tr(" Unknown compatibility level: " + compat)); + msgBox.setText("INTERNAL ERROR: " + message + tr(" Unknown compatibility level: %1").arg(compat)); } if (result == QMessageBox::Ok) { return false; diff --git a/ground/openpilotgcs/src/plugins/hitl/fgsimulator.h b/ground/openpilotgcs/src/plugins/hitl/fgsimulator.h index be5e48539..c30183024 100644 --- a/ground/openpilotgcs/src/plugins/hitl/fgsimulator.h +++ b/ground/openpilotgcs/src/plugins/hitl/fgsimulator.h @@ -26,7 +26,7 @@ */ #ifndef FGSIMULATOR_H -#define FGSIMULATOR_H_H +#define FGSIMULATOR_H #include <QObject> #include "simulator.h" diff --git a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetfactory.h b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetfactory.h index 908bd1f4d..9cfccc008 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetfactory.h +++ b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetfactory.h @@ -25,7 +25,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef OPAMP_GADGETFACTORY_H_ +#ifndef OPMAP_GADGETFACTORY_H_ #define OPMAP_GADGETFACTORY_H_ #include <coreplugin/iuavgadgetfactory.h> @@ -49,4 +49,4 @@ public: IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); }; -#endif // ifndef OPAMP_GADGETFACTORY_H_ +#endif // ifndef OPMAP_GADGETFACTORY_H_ diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.h b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.h index f36bbb6fe..5e6fa96a6 100644 --- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.h +++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.h @@ -15,7 +15,7 @@ */ #ifndef PFDQMLGADGET_H_ -#define PFDQMLQMLGADGET_H_ +#define PFDQMLGADGET_H_ #include <coreplugin/iuavgadget.h> #include "pfdqmlgadgetwidget.h" @@ -51,4 +51,4 @@ private: }; -#endif // PFDQMLQMLGADGET_H_ +#endif // PFDQMLGADGET_H_ diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.h b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.h index 076cd8d99..d9b466347 100644 --- a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.h +++ b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.h @@ -26,7 +26,7 @@ */ #ifndef QMLVIEWGADGET_H_ -#define QMLVIEWQMLGADGET_H_ +#define QMLVIEWGADGET_H_ #include <coreplugin/iuavgadget.h> #include "qmlviewgadgetwidget.h" @@ -62,4 +62,4 @@ private: }; -#endif // QMLVIEWQMLGADGET_H_ +#endif // QMLVIEWGADGET_H_ diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp index a7796f0cc..eed01b3a9 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp @@ -616,7 +616,7 @@ void ConfigTaskWidget::autoLoadWidgets() uiRelation.url = str.mid(str.indexOf(":") + 1); } } - if (!uiRelation.buttonType == none) { + if (!(uiRelation.buttonType == none)) { QPushButton *button = NULL; switch (uiRelation.buttonType) { case save_button: diff --git a/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp b/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp index d090fc0ed..58401b8a0 100644 --- a/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp @@ -299,7 +299,7 @@ OP_DFU::Status DFUObject::UploadDescription(QVariant desc) cout << "Starting uploading description\n"; QByteArray array; - if (desc.type() == QMetaType::QString) { + if (desc.type() == QVariant::String) { QString description = desc.toString(); if (description.length() % 4 != 0) { int pad = description.length() / 4; @@ -310,7 +310,7 @@ OP_DFU::Status DFUObject::UploadDescription(QVariant desc) description.append(padding); } array = description.toLatin1(); - } else if (desc.type() == QMetaType::QByteArray) { + } else if (desc.type() == QVariant::ByteArray) { array = desc.toByteArray(); } diff --git a/ground/openpilotgcs/src/rpath.pri b/ground/openpilotgcs/src/rpath.pri index 6d000262f..1b1fcd395 100644 --- a/ground/openpilotgcs/src/rpath.pri +++ b/ground/openpilotgcs/src/rpath.pri @@ -1,12 +1,8 @@ -macx { - QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Plugins/ -} else:linux-* { - #do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR - # this expands to $ORIGIN (after qmake and make), it does NOT read a qmake var - QMAKE_RPATHDIR = \$\$ORIGIN/../$$GCS_LIBRARY_BASENAME/openpilotgcs - QMAKE_RPATHDIR += \$\$ORIGIN/../$$GCS_LIBRARY_BASENAME/qt5 +linux { + # HACK! Do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR before Qt 5.4 + # \'\$$ORIGIN\' expands to $ORIGIN (after qmake and make), it does NOT read a qmake var GCS_PLUGIN_RPATH = $$join(QMAKE_RPATHDIR, ":") - QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,$${GCS_PLUGIN_RPATH}\' + QMAKE_LFLAGS += -Wl,-z,origin,-rpath,$${GCS_PLUGIN_RPATH} QMAKE_RPATHDIR = } diff --git a/make/tools.mk b/make/tools.mk index 779ac6798..4ff9da7b9 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -9,8 +9,6 @@ # Ready to use: # arm_sdk_install # qt_sdk_install -# mingw_install (Windows only - NOT USED for Qt-5.3.x) -# python_install (Windows only - NOT USED for Qt-5.3.x) # nsis_install (Windows only) # sdl_install (Windows only) # openssl_install (Windows only) @@ -61,14 +59,14 @@ ifeq ($(UNAME), Linux) ifeq ($(ARCH), x86_64) ARM_SDK_URL := https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2 ARM_SDK_MD5_URL:= https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2/+md5 - QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.3/5.3.1/qt-opensource-linux-x64-5.3.1.run - QT_SDK_MD5_URL := http://download.qt-project.org/official_releases/qt/5.3/5.3.1/qt-opensource-linux-x64-5.3.1.run.md5 + QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.4/5.4.0/qt-opensource-linux-x64-5.4.0.run + QT_SDK_MD5_URL := http://download.qt-project.org/official_releases/qt/5.4/5.4.0/qt-opensource-linux-x64-5.4.0.run.md5 QT_SDK_ARCH := gcc_64 else ARM_SDK_URL := https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2 ARM_SDK_MD5_URL := https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2/+md5 - QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.3/5.3.1/qt-opensource-linux-x86-5.3.1.run - QT_SDK_MD5_URL := http://download.qt-project.org/official_releases/qt/5.3/5.3.1/qt-opensource-linux-x86-5.3.1.run.md5 + QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.4/5.4.0/qt-opensource-linux-x86-5.4.0.run + QT_SDK_MD5_URL := http://download.qt-project.org/official_releases/qt/5.4/5.4.0/qt-opensource-linux-x86-5.4.0.run.md5 QT_SDK_ARCH := gcc endif UNCRUSTIFY_URL := http://wiki.openpilot.org/download/attachments/18612236/uncrustify-0.60.tar.gz @@ -87,9 +85,9 @@ else ifeq ($(UNAME), Darwin) else ifeq ($(UNAME), Windows) ARM_SDK_URL := https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-win32.zip ARM_SDK_MD5_URL:= https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-win32.zip/+md5 - QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.3/5.3.1/qt-opensource-windows-x86-mingw482_opengl-5.3.1.exe - QT_SDK_MD5_URL := http://download.qt-project.org/official_releases/qt/5.3/5.3.1/qt-opensource-windows-x86-mingw482_opengl-5.3.1.exe.md5 - QT_SDK_ARCH := mingw482_32 + QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.4/5.4.0/qt-opensource-windows-x86-mingw491_opengl-5.4.0.exe + QT_SDK_MD5_URL := http://download.qt-project.org/official_releases/qt/5.4/5.4.0/qt-opensource-windows-x86-mingw491_opengl-5.4.0.exe.md5 + QT_SDK_ARCH := mingw491_32 NSIS_URL := http://wiki.openpilot.org/download/attachments/18612236/nsis-2.46-unicode.tar.bz2 SDL_URL := http://wiki.openpilot.org/download/attachments/18612236/SDL-devel-1.2.15-mingw32.tar.gz OPENSSL_URL := http://wiki.openpilot.org/download/attachments/18612236/openssl-1.0.1e-win32.tar.bz2 @@ -103,9 +101,9 @@ GTEST_URL := http://wiki.openpilot.org/download/attachments/18612236/gtest-1.6.0 # When changing PYTHON_DIR, you must also update it in ground/openpilotgcs/src/python.pri # When changing SDL_DIR or OPENSSL_DIR, you must also update them in ground/openpilotgcs/openpilotgcs.pri ARM_SDK_DIR := $(TOOLS_DIR)/gcc-arm-none-eabi-4_8-2014q1 -QT_SDK_DIR := $(TOOLS_DIR)/qt-5.3.1 -MINGW_DIR := $(QT_SDK_DIR)/Tools/mingw48_32 -PYTHON_DIR := $(QT_SDK_DIR)/Tools/mingw48_32/opt/bin +QT_SDK_DIR := $(TOOLS_DIR)/qt-5.4.0 +MINGW_DIR := $(QT_SDK_DIR)/Tools/mingw491_32 +PYTHON_DIR := $(QT_SDK_DIR)/Tools/mingw491_32/opt/bin NSIS_DIR := $(TOOLS_DIR)/nsis-2.46-unicode SDL_DIR := $(TOOLS_DIR)/SDL-1.2.15 OPENSSL_DIR := $(TOOLS_DIR)/openssl-1.0.1e-win32 @@ -303,8 +301,6 @@ endef # ############################## - - define TOOL_INSTALL_TEMPLATE .PHONY: $(addprefix $(1)_, install clean distclean) @@ -367,14 +363,11 @@ qt_sdk_install: qt_sdk_clean | $(DL_DIR) $(TOOLS_DIR) $(V1) $(DL_DIR)/$(5) --dump-binary-data -o $(1) # Extract packages under tool directory $(V1) $(MKDIR) -p $$(call toprel, $(dir $(2))) - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0-0qt-project-url.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt/5.3.1ThirdPartySoftware_Listing.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0-0readme.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.53.win32_mingw482/5.3.1-0qt5_essentials.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.53.win32_mingw482/5.3.1-0i686-4.8.2-release-posix-dwarf-rt_v3-rev3-runtime.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.53.win32_mingw482/5.3.1-0icu_52_1_mingw_builds_32_4_8_2_posix_dwarf.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.53.win32_mingw482/5.3.1-0qt5_addons.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.tools.win32_mingw482/4.8.2i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.54.win32_mingw491/5.4.0-1qt5_essentials.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.54.win32_mingw491/5.4.0-1i686-4.9.1-release-posix-dwarf-rt_v3-rev2-runtime.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.54.win32_mingw491/5.4.0-1icu_53_1_mingw_builds_4_9_1_posix_dwarf_32.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.54.win32_mingw491/5.4.0-1qt5_addons.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.tools.win32_mingw491/4.9.1-2i686-4.9.1-release-posix-dwarf-rt_v3-rev2.7z" | grep -v Extracting # Run patcher @$(ECHO) @$(ECHO) "Executing QtPatch in" $$(call toprel, $(QT_SDK_PREFIX)) @@ -434,20 +427,14 @@ qt_sdk_install: qt_sdk_clean | $(DL_DIR) $(TOOLS_DIR) $(V1) $(DL_DIR)/$(5) --dump-binary-data -o $(1) # Extract packages under tool directory $(V1) $(MKDIR) -p $$(call toprel, $(dir $(2))) - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0-0qt-project-url.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt/5.3.1ThirdPartySoftware_Listing.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0-0readme.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.53.$(6)/5.3.1-0qt5_essentials.7z" | grep -v Extracting - $(V1) if [ -f "$(1)/qt.53.$(6)/5.3.1-0icu_52_1_ubuntu_11_10_64.7z" ]; then $(SEVENZIP) -y -o$(2) x "$(1)/qt.53.$(6)/5.3.1-0icu_52_1_ubuntu_11_10_64.7z" | grep -v Extracting; fi - $(V1) if [ -f "$(1)/qt.53.$(6)/5.3.1-0icu_52_1_ubuntu_11_10_32.7z" ]; then $(SEVENZIP) -y -o$(2) x "$(1)/qt.53.$(6)/5.3.1-0icu_52_1_ubuntu_11_10_32.7z" | grep -v Extracting; fi - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.53.$(6)/5.3.1-0qt5_addons.7z" | grep -v Extracting -# go to OpenPilot/tools/5.3.1/gcc_64 and call patcher.sh + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.54.$(6)/5.4.0-1qt5_essentials.7z" | grep -v Extracting + $(V1) if [ -f "$(1)/qt.54.$(6)/5.4.0-1icu_53_1_ubuntu_11_10_64.7z" ]; then $(SEVENZIP) -y -o$(2) x "$(1)/qt.54.$(6)/5.4.0-1icu_53_1_ubuntu_11_10_64.7z" | grep -v Extracting; fi + $(V1) if [ -f "$(1)/qt.54.$(6)/5.4.0-1icu_53_1_ubuntu_11_10_32.7z" ]; then $(SEVENZIP) -y -o$(2) x "$(1)/qt.54.$(6)/5.4.0-1icu_53_1_ubuntu_11_10_32.7z" | grep -v Extracting; fi + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.54.$(6)/5.4.0-1qt5_addons.7z" | grep -v Extracting +# Run patcher @$(ECHO) - @$(ECHO) "Running patcher in" $$(call toprel, $(QT_SDK_PREFIX)) - $(V1) $(CD) $(QT_SDK_PREFIX) -# $(V1) "$(QT_SDK_PREFIX)/patcher.sh" $(QT_SDK_PREFIX) -# call qmake patcher @$(ECHO) "Executing QtPatch in" $$(call toprel, $(QT_SDK_PREFIX)) + $(V1) $(CD) $(QT_SDK_PREFIX) $(V1) $(DL_DIR)/$(5) --runoperation QtPatch linux $(QT_SDK_PREFIX) qt5 # Execute post build templates @@ -472,7 +459,6 @@ qt_sdk_distclean: endef - ############################## # # Mac QT install template @@ -550,13 +536,19 @@ endef # ARM SDK # ############################## + ifeq ($(UNAME), Windows) -#unfortunately zip package for this release is missing root directory, so adding / at the end of the path + +# unfortunately zip package for this release is missing root directory, so adding / at the end of the path # so that template interpret last part as directory and use the full path $(eval $(call TOOL_INSTALL_TEMPLATE,arm_sdk,$(ARM_SDK_DIR)/,$(ARM_SDK_URL),$(ARM_SDK_MD5_URL),$(notdir $(ARM_SDK_URL)))) + else + $(eval $(call TOOL_INSTALL_TEMPLATE,arm_sdk,$(ARM_SDK_DIR),$(ARM_SDK_URL),$(ARM_SDK_MD5_URL),$(notdir $(ARM_SDK_URL)))) + endif + ifeq ($(shell [ -d "$(ARM_SDK_DIR)" ] && $(ECHO) "exists"), exists) export ARM_SDK_PREFIX := $(ARM_SDK_DIR)/bin/arm-none-eabi- else @@ -586,7 +578,7 @@ endef ifeq ($(UNAME), Windows) -QT_SDK_PREFIX := $(QT_SDK_DIR)/5.3/$(QT_SDK_ARCH) +QT_SDK_PREFIX := $(QT_SDK_DIR)/5.4/$(QT_SDK_ARCH) # This additional configuration step should not be necessary # but it is needed as a workaround to https://bugreports.qt-project.org/browse/QTBUG-33254 @@ -601,7 +593,7 @@ QT_BUILD_DIR := $(BUILD_DIR)/QT_BUILD else ifeq ($(UNAME), Linux) -QT_SDK_PREFIX := "$(QT_SDK_DIR)/5.3/$(QT_SDK_ARCH)" +QT_SDK_PREFIX := "$(QT_SDK_DIR)/5.4/$(QT_SDK_ARCH)" QT_BUILD_DIR := $(BUILD_DIR)/QT_BUILD $(eval $(call LINUX_QT_INSTALL_TEMPLATE,$(QT_BUILD_DIR),$(QT_SDK_DIR),$(QT_SDK_URL),$(QT_SDK_MD5_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_ARCH))) @@ -618,7 +610,7 @@ QT_SDK_PREFIX := $(QT_SDK_DIR) .PHONY: qt_sdk_install qt_sdk_install: @$(ECHO) $(MSG_NOTICE) -------------------------------------------------------- - @$(ECHO) $(MSG_NOTICE) Please install native Qt 5.3.x SDK using package manager + @$(ECHO) $(MSG_NOTICE) Please install native Qt 5.4.x SDK using package manager @$(ECHO) $(MSG_NOTICE) -------------------------------------------------------- .PHONY: qt_sdk_clean diff --git a/package/linux/deb_common/rules b/package/linux/deb_common/rules index 4ee22cc13..0977cdeed 100644 --- a/package/linux/deb_common/rules +++ b/package/linux/deb_common/rules @@ -47,7 +47,7 @@ ifdef PACKAGE_DIR else $(error PACKAGE_DIR not defined! $(PACKAGE_DIR)) endif - ln -s /usr/local/OpenPilot/bin/openpilotgcs.bin `pwd`/debian/openpilot/usr/bin/openpilot-gcs + ln -s /usr/local/OpenPilot/bin/openpilotgcs `pwd`/debian/openpilot/usr/bin/openpilotgcs rm -rf debian/openpilot/usr/local/OpenPilot/share/openpilotgcs/sounds/sounds rm -rf debian/openpilot/usr/local/OpenPilot/share/openpilotgcs/pfd/pfd rm -rf debian/openpilot/usr/local/OpenPilot/share/openpilotgcs/models/models diff --git a/package/linux/openpilot.desktop b/package/linux/openpilot.desktop index 5ce67af5d..3a71981c9 100644 --- a/package/linux/openpilot.desktop +++ b/package/linux/openpilot.desktop @@ -2,8 +2,8 @@ Version=0.1.0 Encoding=UTF-8 Name=OpenPilot GCS -Exec=openpilot-gcs -TryExec=openpilot-gcs +Exec=openpilotgcs +TryExec=openpilotgcs Comment=Configure, Tune, Diagnose, Track, & Upgrade FW for OpenPilot solutions Terminal=false Categories=OpenPilotMenu;Qt;Other;