diff --git a/README.md b/README.md index a809c2559..53a1091d2 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,10 @@ Links for the LibrePilot Project - [Main project web site](https://www.librepilot.org) - [Project forums](https://forum.librepilot.org) +- [Software downloads](https://librepilot.atlassian.net/wiki/display/LPDOC/Downloads) +- [Wiki](https://librepilot.atlassian.net/wiki/display/LPDOC/Welcome) - [Source code repository](https://bitbucket.org/librepilot) - [Mirror](https://github.com/librepilot) - [Issue tracker](https://librepilot.atlassian.net) - [Gitter Chat](https://gitter.im/librepilot/LibrePilot) - IRC: #LibrePilot on FreeNode - diff --git a/flight/modules/Telemetry/telemetry.c b/flight/modules/Telemetry/telemetry.c index f7839427f..dad266505 100644 --- a/flight/modules/Telemetry/telemetry.c +++ b/flight/modules/Telemetry/telemetry.c @@ -100,30 +100,35 @@ #ifdef PIOS_INCLUDE_RFM22B #define HAS_RADIO #endif + // Private types typedef struct { // Determine port on which to communicate telemetry information uint32_t (*getPort)(); // Main telemetry queue xQueueHandle queue; + #ifdef PIOS_TELEM_PRIORITY_QUEUE // Priority telemetry queue xQueueHandle priorityQueue; #endif /* PIOS_TELEM_PRIORITY_QUEUE */ + // Transmit/receive task handles xTaskHandle txTaskHandle; xTaskHandle rxTaskHandle; // Telemetry stream UAVTalkConnection uavTalkCon; } channelContext; + #ifdef HAS_RADIO // Main telemetry channel static channelContext localChannel; static int32_t transmitLocalData(uint8_t *data, int32_t length); static void registerLocalObject(UAVObjHandle obj); static uint32_t localPort(); +#endif /* ifdef HAS_RADIO */ + static void updateSettings(channelContext *channel); -#endif // OPLink telemetry channel static channelContext radioChannel; @@ -165,6 +170,7 @@ static void gcsTelemetryStatsUpdated(); */ int32_t TelemetryStart(void) { + #ifdef HAS_RADIO // Only start the local telemetry tasks if needed if (localPort()) { @@ -195,6 +201,7 @@ int32_t TelemetryStart(void) localChannel.rxTaskHandle); } #endif /* ifdef HAS_RADIO */ + // Start the telemetry tasks associated with Radio/USB UAVObjIterate(®isterRadioObject); @@ -231,6 +238,7 @@ void TelemetryInitializeChannel(channelContext *channel) // Create object queues channel->queue = xQueueCreate(MAX_QUEUE_SIZE, sizeof(UAVObjEvent)); + #if defined(PIOS_TELEM_PRIORITY_QUEUE) channel->priorityQueue = xQueueCreate(MAX_QUEUE_SIZE, sizeof(UAVObjEvent)); @@ -283,6 +291,7 @@ int32_t TelemetryInitialize(void) // Reset link stats txErrors = 0; txRetries = 0; + #ifdef HAS_RADIO // Set channel port handlers localChannel.getPort = localPort; @@ -297,10 +306,14 @@ int32_t TelemetryInitialize(void) // Initialise UAVTalk localChannel.uavTalkCon = UAVTalkInitialize(&transmitLocalData); } +#endif /* ifdef HAS_RADIO */ -#endif // Set channel port handlers radioChannel.getPort = radioPort; + + // Set the channel port baud rate + updateSettings(&radioChannel); + // Initialise channel TelemetryInitializeChannel(&radioChannel); // Initialise UAVTalk @@ -310,6 +323,7 @@ int32_t TelemetryInitialize(void) } MODULE_INITCALL(TelemetryInitialize, TelemetryStart); + #ifdef HAS_RADIO /** * Register a new object, adds object to local list and connects the queue depending on the object's @@ -333,7 +347,8 @@ static void registerLocalObject(UAVObjHandle obj) EV_NONE); } } -#endif +#endif /* ifdef HAS_RADIO */ + static void registerRadioObject(UAVObjHandle obj) { if (UAVObjIsMetaobject(obj)) { @@ -459,6 +474,7 @@ static void updateObject( UAVObjConnectQueue(obj, channel->priorityQueue, eventMask); } else #endif /* PIOS_TELEM_PRIORITY_QUEUE */ + UAVObjConnectQueue(obj, channel->queue, eventMask); } @@ -584,6 +600,7 @@ static void telemetryTxTask(void *parameters) /** * Tries to empty the high priority queue before handling any standard priority item */ + #ifdef PIOS_TELEM_PRIORITY_QUEUE // empty priority queue, non-blocking while (xQueueReceive(channel->priorityQueue, &ev, 0) == pdTRUE) { @@ -606,6 +623,7 @@ static void telemetryTxTask(void *parameters) processObjEvent(channel, &ev); } #endif /* PIOS_TELEM_PRIORITY_QUEUE */ + } } @@ -650,7 +668,8 @@ static uint32_t localPort() { return PIOS_COM_TELEM_RF; } -#endif + +#endif /* ifdef HAS_RADIO */ /** * Determine the port to be used for communication on the radio channel @@ -688,7 +707,7 @@ static int32_t transmitLocalData(uint8_t *data, int32_t length) return -1; } -#endif +#endif /* ifdef HAS_RADIO */ /** * Transmit data buffer to the radioport. @@ -811,9 +830,11 @@ static void updateTelemetryStats() // Get stats UAVTalkGetStats(radioChannel.uavTalkCon, &utalkStats, true); + #ifdef HAS_RADIO UAVTalkAddStats(localChannel.uavTalkCon, &utalkStats, true); #endif + // Get object data FlightTelemetryStatsGet(&flightStats); GCSTelemetryStatsGet(&gcsStats); @@ -895,7 +916,6 @@ static void updateTelemetryStats() } } -#ifdef HAS_RADIO /** * Update the telemetry settings, called on startup. * FIXME: This should be in the TelemetrySettings object. But objects @@ -939,7 +959,6 @@ static void updateSettings(channelContext *channel) } } -#endif /* ifdef HAS_RADIO */ /** * @} * @} diff --git a/ground/gcs/src/libs/utils/settingsutils.cpp b/ground/gcs/src/libs/utils/stringutils.cpp similarity index 60% rename from ground/gcs/src/libs/utils/settingsutils.cpp rename to ground/gcs/src/libs/utils/stringutils.cpp index c10b9ab42..6e2dfbf17 100644 --- a/ground/gcs/src/libs/utils/settingsutils.cpp +++ b/ground/gcs/src/libs/utils/stringutils.cpp @@ -1,13 +1,11 @@ /** ****************************************************************************** * - * @file settingsutils.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. - * @brief + * @file pathutils.cpp + * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015. + * @brief String utilities + * * @see The GNU Public License (GPL) Version 3 - * @defgroup - * @{ * *****************************************************************************/ /* @@ -26,23 +24,26 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "settingsutils.h" - -#include +#include "stringutils.h" namespace Utils { -QTCREATOR_UTILS_EXPORT QString settingsKey(const QString &category) +QString toLowerCamelCase(const QString & name) { - QString rc(category); - const QChar underscore = QLatin1Char('_'); - const int size = rc.size(); + QString str = name; - for (int i = 0; i < size; i++) { - const QChar c = rc.at(i); - if (!c.isLetterOrNumber() && c != underscore) { - rc[i] = underscore; + for (int i = 0; i < str.length(); ++i) { + if (str[i].isLower() || !str[i].isLetter()) { + break; } + if (i > 0 && i < str.length() - 1) { + // after first, look ahead one + if (str[i + 1].isLower()) { + break; + } + } + str[i] = str[i].toLower(); } - return rc; + + return str; +} } -} // namespace Utils diff --git a/ground/gcs/src/libs/utils/settingsutils.h b/ground/gcs/src/libs/utils/stringutils.h similarity index 69% rename from ground/gcs/src/libs/utils/settingsutils.h rename to ground/gcs/src/libs/utils/stringutils.h index be85a69e7..ad633dc40 100644 --- a/ground/gcs/src/libs/utils/settingsutils.h +++ b/ground/gcs/src/libs/utils/stringutils.h @@ -1,8 +1,8 @@ /** ****************************************************************************** * - * @file settingsutils.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @file stringutils.h + * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015. * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. * @brief * @see The GNU Public License (GPL) Version 3 @@ -26,15 +26,24 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef SETTINGSTUTILS_H -#define SETTINGSTUTILS_H +#ifndef STRINGUTILS_H +#define STRINGUTILS_H #include "utils_global.h" -namespace Utils { -// Create a usable settings key from a category, -// for example Editor|C++ -> Editor_C__ -QTCREATOR_UTILS_EXPORT QString settingsKey(const QString &category); -} // namespace Utils +#include -#endif // SETTINGSTUTILS_H +namespace Utils { +/** + * Convert a string to lower camel case. + * Handles following cases : + * - Property -> property + * - MyProperty -> myProperty + * - MYProperty -> myProperty + * - MY_Property -> my_Property + * - MY -> my + */ +QTCREATOR_UTILS_EXPORT QString toLowerCamelCase(const QString &); +} + +#endif /* STRINGUTILS_H */ diff --git a/ground/gcs/src/libs/utils/utils.pro b/ground/gcs/src/libs/utils/utils.pro index 1e178077d..16701460f 100644 --- a/ground/gcs/src/libs/utils/utils.pro +++ b/ground/gcs/src/libs/utils/utils.pro @@ -13,7 +13,7 @@ DEFINES += PLUGIN_REL_PATH=$$shell_quote(\"$$relative_path($$GCS_PLUGIN_PATH, $$ SOURCES += \ reloadpromptutils.cpp \ - settingsutils.cpp \ + stringutils.cpp \ filesearch.cpp \ pathchooser.cpp \ pathlisteditor.cpp \ @@ -59,6 +59,7 @@ SOURCES += \ mustache.cpp \ textbubbleslider.cpp + SOURCES += xmlconfig.cpp win32 { @@ -73,7 +74,7 @@ else:SOURCES += consoleprocess_unix.cpp HEADERS += \ utils_global.h \ reloadpromptutils.h \ - settingsutils.h \ + stringutils.h \ filesearch.h \ listutils.h \ pathchooser.h \ diff --git a/ground/gcs/src/plugins/config/airframe_fixedwing.ui b/ground/gcs/src/plugins/config/airframe_fixedwing.ui index 7e5ede296..c6901b9b3 100644 --- a/ground/gcs/src/plugins/config/airframe_fixedwing.ui +++ b/ground/gcs/src/plugins/config/airframe_fixedwing.ui @@ -6,8 +6,8 @@ 0 0 - 880 - 608 + 920 + 690 @@ -66,8 +66,8 @@ - 10 - 10 + 250 + 250 @@ -130,8 +130,8 @@ - 10 - 10 + 250 + 250 @@ -514,7 +514,7 @@ margin:1px; Output Channel Assignments - + 9 @@ -538,42 +538,6 @@ margin:1px; 6 - - - - - 70 - 0 - - - - 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; - - - Elevator 2 - - - - - - - true - - - - 0 - 0 - - - - Assign your output channel - - - @@ -755,8 +719,458 @@ margin:1px; + + + + + 70 + 0 + + + + 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; + + + Elevator 2 + + + + + + + true + + + + 0 + 0 + + + + Assign your output channel + + + + + + + QLayout::SetMaximumSize + + + 0 + + + + + Select output curve for Accessory1 RcInput + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory0 RcInput + + + + + + + + 0 + 0 + + + + + 90 + 0 + + + + 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; + + + Accessory0 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 90 + 16 + + + + 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; + + + RC Input + + + Qt::AlignCenter + + + + + + + + 90 + 0 + + + + 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; + + + Accessory1 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 110 + 0 + + + + RcOutput channels + + + 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; + + + RC Output 1 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory2 RcInput + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory1 RcInput + + + + + + + + 90 + 0 + + + + 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; + + + Accessory2 + + + Qt::AlignCenter + + + + + + + + 90 + 0 + + + + RcOutput curve + + + 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; + + + Curve + + + Qt::AlignCenter + + + + + + + Select output curve for Accessory0 RcInput + + + + + + + Select output curve for Accessory3 RcInput + + + + + + + Select output curve for Accessory2 RcInput + + + + + + + + 90 + 0 + + + + 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; + + + Accessory3 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory3 RcInput + + + + + + + + 0 + 0 + + + + + 110 + 0 + + + + RcOutput channels + + + 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; + + + RC Output 2 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory0 RcInput + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory1 RcInput + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory2 RcInput + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select output channel for Accessory3 RcInput + + + + + + + + + Qt::Vertical + + + diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp b/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp index 65f5084f7..0edbc616c 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp @@ -51,7 +51,8 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions() } // get the gui config data - GUIConfigDataUnion configData = getConfigData(); + GUIConfigDataUnion configData = getConfigData(); + fixedGUISettingsStruct fixedwing = configData.fixedwing; if (configData.fixedwing.FixedWingPitch1 > 0) { channelDesc[configData.fixedwing.FixedWingPitch1 - 1] = QString("FixedWingPitch1"); @@ -74,6 +75,33 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions() if (configData.fixedwing.FixedWingThrottle > 0) { channelDesc[configData.fixedwing.FixedWingThrottle - 1] = QString("FixedWingThrottle"); } + + if (fixedwing.Accessory0 > 0 && fixedwing.Accessory0 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory0 - 1] = QString("Accessory0-1"); + } + if (fixedwing.Accessory1 > 0 && fixedwing.Accessory1 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory1 - 1] = QString("Accessory1-1"); + } + if (fixedwing.Accessory2 > 0 && fixedwing.Accessory2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory2 - 1] = QString("Accessory2-1"); + } + if (fixedwing.Accessory3 > 0 && fixedwing.Accessory3 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory3 - 1] = QString("Accessory3-1"); + } + + if (fixedwing.Accessory0_2 > 0 && fixedwing.Accessory0_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory0_2 - 1] = QString("Accessory0-2"); + } + if (fixedwing.Accessory1_2 > 0 && fixedwing.Accessory1_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory1_2 - 1] = QString("Accessory1-2"); + } + if (fixedwing.Accessory2_2 > 0 && fixedwing.Accessory2_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory2_2 - 1] = QString("Accessory2-2"); + } + if (fixedwing.Accessory3_2 > 0 && fixedwing.Accessory3_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) { + channelDesc[fixedwing.Accessory3_2 - 1] = QString("Accessory3-2"); + } + return channelDesc; } @@ -84,6 +112,13 @@ ConfigFixedWingWidget::ConfigFixedWingWidget(QWidget *parent) : populateChannelComboBoxes(); + QStringList mixerCurveList; + mixerCurveList << "Curve1" << "Curve2"; + m_aircraft->rcOutputCurveBoxFw1->addItems(mixerCurveList); + m_aircraft->rcOutputCurveBoxFw2->addItems(mixerCurveList); + m_aircraft->rcOutputCurveBoxFw3->addItems(mixerCurveList); + m_aircraft->rcOutputCurveBoxFw4->addItems(mixerCurveList); + QStringList fixedWingTypes; fixedWingTypes << "Aileron" << "Elevon" << "Vtail"; m_aircraft->fixedWingType->addItems(fixedWingTypes); @@ -238,6 +273,18 @@ void ConfigFixedWingWidget::registerWidgets(ConfigTaskWidget &parent) parent.addWidget(m_aircraft->elevonSlider1); parent.addWidget(m_aircraft->elevonSlider2); parent.addWidget(m_aircraft->elevonSlider3); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw1); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw2); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw3); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw4); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw1_2); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw2_2); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw3_2); + parent.addWidget(m_aircraft->rcOutputChannelBoxFw4_2); + parent.addWidget(m_aircraft->rcOutputCurveBoxFw1); + parent.addWidget(m_aircraft->rcOutputCurveBoxFw2); + parent.addWidget(m_aircraft->rcOutputCurveBoxFw3); + parent.addWidget(m_aircraft->rcOutputCurveBoxFw4); } void ConfigFixedWingWidget::resetActuators(GUIConfigDataUnion *configData) @@ -251,6 +298,44 @@ void ConfigFixedWingWidget::resetActuators(GUIConfigDataUnion *configData) configData->fixedwing.FixedWingThrottle = 0; } +void ConfigFixedWingWidget::resetRcOutputs(GUIConfigDataUnion *configData) +{ + configData->fixedwing.Accessory0 = 0; + configData->fixedwing.Accessory1 = 0; + configData->fixedwing.Accessory2 = 0; + configData->fixedwing.Accessory3 = 0; + configData->fixedwing.Accessory0_2 = 0; + configData->fixedwing.Accessory1_2 = 0; + configData->fixedwing.Accessory2_2 = 0; + configData->fixedwing.Accessory3_2 = 0; +} + + +void ConfigFixedWingWidget::updateRcCurvesUsed() +{ + UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); + + Q_ASSERT(mixer); + + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw1, VehicleConfig::MIXER_THROTTLECURVE1); + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw2, VehicleConfig::MIXER_THROTTLECURVE1); + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw3, VehicleConfig::MIXER_THROTTLECURVE1); + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw4, VehicleConfig::MIXER_THROTTLECURVE1); + + for (int channel = 0; channel < (int)ConfigFixedWingWidget::CHANNEL_NUMELEM; channel++) { + QString mixerType = getMixerType(mixer, channel); + if (mixerType == "Accessory0" && getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2)) { + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw1, VehicleConfig::MIXER_THROTTLECURVE2); + } else if (mixerType == "Accessory1" && getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2)) { + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw2, VehicleConfig::MIXER_THROTTLECURVE2); + } else if (mixerType == "Accessory2" && getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2)) { + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw3, VehicleConfig::MIXER_THROTTLECURVE2); + } else if (mixerType == "Accessory3" && getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2)) { + setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw4, VehicleConfig::MIXER_THROTTLECURVE2); + } + } +} + /** Virtual function to refresh the UI widget values */ @@ -287,6 +372,18 @@ void ConfigFixedWingWidget::refreshWidgetsValues(QString frameType) setComboCurrentIndex(m_aircraft->fwRudder1ChannelBox, fixed.FixedWingYaw1); setComboCurrentIndex(m_aircraft->fwRudder2ChannelBox, fixed.FixedWingYaw2); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw1, fixed.Accessory0); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw2, fixed.Accessory1); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw3, fixed.Accessory2); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw4, fixed.Accessory3); + + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw1_2, fixed.Accessory0_2); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw2_2, fixed.Accessory1_2); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw3_2, fixed.Accessory2_2); + setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw4_2, fixed.Accessory3_2); + + updateRcCurvesUsed(); + // Get mixing values for GUI sliders (values stored onboard) m_aircraft->elevonSlider3->setValue(getMixerValue(mixer, "RollDifferential")); if (frameType == "FixedWingElevon" || frameType == "Elevon") { @@ -310,6 +407,13 @@ QString ConfigFixedWingWidget::updateConfigObjectsFromWidgets() Q_ASSERT(mixer); + // Reset all Mixers type + resetAllMixersType(mixer); + + QList rcOutputList; + rcOutputList << "Accessory0" << "Accessory1" << "Accessory2" << "Accessory3"; + setupRcOutputs(rcOutputList); + // Set the throttle curve setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->fixedWingThrottle->getCurve()); @@ -580,6 +684,118 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType) return true; } +/** + Helper function: setup rc outputs. Takes a list of channel names in input. + */ +void ConfigFixedWingWidget::setupRcOutputs(QList rcOutputList) +{ + QList rcList; + rcList << m_aircraft->rcOutputChannelBoxFw1 << m_aircraft->rcOutputChannelBoxFw2 + << m_aircraft->rcOutputChannelBoxFw3 << m_aircraft->rcOutputChannelBoxFw4; + + QList rcList2; + rcList2 << m_aircraft->rcOutputChannelBoxFw1_2 << m_aircraft->rcOutputChannelBoxFw2_2 + << m_aircraft->rcOutputChannelBoxFw3_2 << m_aircraft->rcOutputChannelBoxFw4_2; + + GUIConfigDataUnion configData = getConfigData(); + resetRcOutputs(&configData); + + UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject("MixerSettings")); + Q_ASSERT(mixer); + + int curveAccessory0 = m_aircraft->rcOutputCurveBoxFw1->currentIndex(); + int curveAccessory1 = m_aircraft->rcOutputCurveBoxFw2->currentIndex(); + int curveAccessory2 = m_aircraft->rcOutputCurveBoxFw3->currentIndex(); + int curveAccessory3 = m_aircraft->rcOutputCurveBoxFw4->currentIndex(); + + foreach(QString rc_output, rcOutputList) { + int index = rcList.takeFirst()->currentIndex(); + int index2 = rcList2.takeFirst()->currentIndex(); + + if (rc_output == "Accessory0") { + // First output for Accessory0 + configData.fixedwing.Accessory0 = index; + if (index) { + setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY0); + if (curveAccessory0) { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + // Second output for Accessory0 + configData.fixedwing.Accessory0_2 = index2; + if (index2) { + setMixerType(mixer, index2 - 1, VehicleConfig::MIXERTYPE_ACCESSORY0); + if (curveAccessory0) { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + } else if (rc_output == "Accessory1") { + configData.fixedwing.Accessory1 = index; + configData.fixedwing.Accessory1_2 = index2; + if (index) { + setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY1); + if (curveAccessory1) { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + if (index2) { + setMixerType(mixer, index2 - 1, VehicleConfig::MIXERTYPE_ACCESSORY1); + if (curveAccessory1) { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + } else if (rc_output == "Accessory2") { + configData.fixedwing.Accessory2 = index; + configData.fixedwing.Accessory2_2 = index2; + if (index) { + setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY2); + if (curveAccessory2) { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + if (index2) { + setMixerType(mixer, index2 - 1, VehicleConfig::MIXERTYPE_ACCESSORY2); + if (curveAccessory2) { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + } else if (rc_output == "Accessory3") { + configData.fixedwing.Accessory3 = index; + configData.fixedwing.Accessory3_2 = index2; + if (index) { + setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY3); + if (curveAccessory3) { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + if (index2) { + setMixerType(mixer, index2 - 1, VehicleConfig::MIXERTYPE_ACCESSORY3); + if (curveAccessory3) { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + } else { + setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); + } + } + } + } + setConfigData(configData); +} + + void ConfigFixedWingWidget::enableControls(bool enable) { ConfigTaskWidget::enableControls(enable); @@ -648,6 +864,44 @@ bool ConfigFixedWingWidget::throwConfigError(QString airframeType) channelNames += (combobox->currentText() == "None") ? "" : combobox->currentText(); } } + + // Iterate through all instances of rcOutputChannelBoxFw + for (int i = 0; i < 5; i++) { + // Find widgets with his name "rcOutputChannelBoxFw.x", where x is an integer + QComboBox *combobox = this->findChild("rcOutputChannelBoxFw" + QString::number(i + 1)); + if (combobox) { + if (channelNames.contains(combobox->currentText(), Qt::CaseInsensitive)) { + int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize); + QPixmap pixmap(size, size); + pixmap.fill(QColor("orange")); + combobox->setItemData(combobox->currentIndex(), pixmap, Qt::DecorationRole); // Set color palettes + combobox->setToolTip(tr("Channel already used")); + } else { + for (int index = 0; index < (int)ConfigFixedWingWidget::CHANNEL_NUMELEM; index++) { + combobox->setItemData(index, 0, Qt::DecorationRole); // Reset all color palettes + combobox->setToolTip(tr("Select first output channel for Accessory%1 RcInput").arg(i)); + } + } + channelNames += (combobox->currentText() == "None") ? "" : combobox->currentText(); + } + // Find duplicates in second output comboboxes + QComboBox *combobox2 = this->findChild("rcOutputChannelBoxFw" + QString::number(i + 1) + "_2"); + if (combobox2) { + if (channelNames.contains(combobox2->currentText(), Qt::CaseInsensitive)) { + int size = combobox2->style()->pixelMetric(QStyle::PM_SmallIconSize); + QPixmap pixmap(size, size); + pixmap.fill(QColor("orange")); + combobox2->setItemData(combobox2->currentIndex(), pixmap, Qt::DecorationRole); // Set color palettes + combobox2->setToolTip(tr("Channel already used")); + } else { + for (int index = 0; index < (int)ConfigFixedWingWidget::CHANNEL_NUMELEM; index++) { + combobox2->setItemData(index, 0, Qt::DecorationRole); // Reset all color palettes + combobox2->setToolTip(tr("Select second output channel for Accessory%1 RcInput").arg(i)); + } + } + channelNames += (combobox2->currentText() == "None") ? "" : combobox2->currentText(); + } + } return error; } diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h b/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h index 5e25d99d3..e61add426 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h @@ -58,10 +58,13 @@ private: virtual void registerWidgets(ConfigTaskWidget &parent); virtual void resetActuators(GUIConfigDataUnion *configData); + virtual void resetRcOutputs(GUIConfigDataUnion *configData); bool setupFrameFixedWing(QString airframeType); bool setupFrameElevon(QString airframeType); bool setupFrameVtail(QString airframeType); + void setupRcOutputs(QList rcOutputList); + void updateRcCurvesUsed(); protected: void enableControls(bool enable); diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp b/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp index 78a2b6b9d..e90f838e9 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp @@ -373,18 +373,6 @@ void ConfigMultiRotorWidget::resetRcOutputs(GUIConfigDataUnion *configData) configData->multi.Accessory3 = 0; } -void ConfigMultiRotorWidget::resetMixers() -{ - UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); - - Q_ASSERT(mixer); - - for (int channel = 0; channel < (int)ConfigMultiRotorWidget::CHANNEL_NUMELEM; channel++) { - resetMixerVector(mixer, channel); - setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_DISABLED); - } -} - void ConfigMultiRotorWidget::updateRcCurvesUsed() { UAVDataObject *mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); @@ -545,8 +533,8 @@ QString ConfigMultiRotorWidget::updateConfigObjectsFromWidgets() Q_ASSERT(mixer); - // Reset all Mixers - resetMixers(); + // Reset all Mixers types + resetAllMixersType(mixer); QList rcOutputList; rcOutputList << "Accessory0" << "Accessory1" << "Accessory2" << "Accessory3"; diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h b/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h index 488fd5cce..df44c73f6 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h @@ -73,7 +73,6 @@ private: bool setupMultiRotorMixer(double mixerFactors[8][3]); void setupMotors(QList motorList); void setupRcOutputs(QList rcOutputList); - void resetMixers(); void setupQuadMotor(int channel, double roll, double pitch, double yaw); void setYawMixLevel(int); diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp b/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp index 621f539eb..bbea43bb9 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp @@ -232,6 +232,15 @@ void VehicleConfig::resetMotorAndServoMixers(UAVDataObject *mixer) } } +// Disable all mixers types +void VehicleConfig::resetAllMixersType(UAVDataObject *mixer) +{ + for (int channel = 0; channel < (int)VehicleConfig::CHANNEL_NUMELEM; channel++) { + resetMixerVector(mixer, channel); + setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_DISABLED); + } +} + double VehicleConfig::getMixerVectorValue(UAVDataObject *mixer, int channel, MixerVectorElem elementName) { Q_ASSERT(mixer); diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h b/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h index f4a9765ac..88d6f15a4 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h @@ -89,10 +89,17 @@ typedef struct { uint FixedWingPitch2 : 4; uint FixedWingYaw1 : 4; uint FixedWingYaw2 : 4; - uint padding : 4; // 32 bits + uint Accessory0 : 4; // 32 bits + uint Accessory1 : 4; + uint Accessory2 : 4; + uint Accessory3 : 4; + uint Accessory0_2 : 4; + uint Accessory1_2 : 4; + uint Accessory2_2 : 4; + uint Accessory3_2 : 4; + quint32 padding : 4; // 64bits quint32 padding1; - quint32 padding2; - quint32 padding3; // 128 bits + quint32 padding2; // 128 bits } __attribute__((packed)) fixedGUISettingsStruct; typedef struct { @@ -228,6 +235,7 @@ protected: void setMixerVectorValue(UAVDataObject *mixer, int channel, MixerVectorElem elementName, double value); void resetMixerVector(UAVDataObject *mixer, int channel); void resetMotorAndServoMixers(UAVDataObject *mixer); + void resetAllMixersType(UAVDataObject *mixer); QString getMixerType(UAVDataObject *mixer, int channel); void setMixerType(UAVDataObject *mixer, int channel, MixerTypeElem mixerType); void setThrottleCurve(UAVDataObject *mixer, MixerThrottleCurveElem curveType, QList curve); diff --git a/ground/gcs/src/plugins/config/configinputwidget.cpp b/ground/gcs/src/plugins/config/configinputwidget.cpp index 7bbe10bf8..c1523e331 100644 --- a/ground/gcs/src/plugins/config/configinputwidget.cpp +++ b/ground/gcs/src/plugins/config/configinputwidget.cpp @@ -1645,6 +1645,46 @@ void ConfigInputWidget::moveFMSlider() pos = manualSettingsDataPriv.FlightModeNumber - 1; } ui->fmsSlider->setValue(pos); + highlightStabilizationMode(pos); +} + +void ConfigInputWidget::highlightStabilizationMode(int pos) +{ + QComboBox *comboboxFm = this->findChild("fmsModePos" + QString::number(pos + 1)); + QString customStyleSheet = "QComboBox:editable:!on{background: #feb103;}"; + + if (comboboxFm) { + QString flightModeText = comboboxFm->currentText(); + comboboxFm->setStyleSheet(""); + for (uint8_t i = 0; i < FlightModeSettings::FLIGHTMODEPOSITION_NUMELEM; i++) { + QLabel *label = this->findChild("stab" + QString::number(i + 1) + "_label"); + QComboBox *comboRoll = this->findChild("fmsSsPos" + QString::number(i + 1) + "Roll"); + QComboBox *comboPitch = this->findChild("fmsSsPos" + QString::number(i + 1) + "Pitch"); + QComboBox *comboYaw = this->findChild("fmsSsPos" + QString::number(i + 1) + "Yaw"); + QComboBox *comboThrust = this->findChild("fmsSsPos" + QString::number(i + 1) + "Thrust"); + QComboBox *comboboxFm2 = this->findChild("fmsModePos" + QString::number(i + 1)); + comboboxFm2->setStyleSheet(""); + + // Highlight current stabilization mode if any. + if ((flightModeText.contains("Stabilized", Qt::CaseInsensitive)) && (flightModeText.contains(QString::number(i + 1), Qt::CaseInsensitive))) { + label->setStyleSheet("border-radius: 4px; border:3px solid #feb103;"); + comboRoll->setStyleSheet(customStyleSheet); + comboPitch->setStyleSheet(customStyleSheet); + comboYaw->setStyleSheet(customStyleSheet); + comboThrust->setStyleSheet(customStyleSheet); + } else { + label->setStyleSheet(""); + comboRoll->setStyleSheet(""); + comboPitch->setStyleSheet(""); + comboYaw->setStyleSheet(""); + comboThrust->setStyleSheet(""); + if (!flightModeText.contains("Stabilized", Qt::CaseInsensitive)) { + // Highlight PosHold, Return to Base, ... flightmodes + comboboxFm->setStyleSheet(customStyleSheet); + } + } + } + } } void ConfigInputWidget::updatePositionSlider() diff --git a/ground/gcs/src/plugins/config/configinputwidget.h b/ground/gcs/src/plugins/config/configinputwidget.h index eb7778289..00e460f64 100644 --- a/ground/gcs/src/plugins/config/configinputwidget.h +++ b/ground/gcs/src/plugins/config/configinputwidget.h @@ -202,6 +202,8 @@ private: AccessoryDesired *getAccessoryDesiredInstance(int instance); float getAccessoryDesiredValue(int instance); + void highlightStabilizationMode(int pos); + private slots: void wzNext(); void wzNextDelayed(); diff --git a/ground/gcs/src/plugins/config/images/fixedwing-shapes.svg b/ground/gcs/src/plugins/config/images/fixedwing-shapes.svg index 1d36aa374..d9c88d775 100644 --- a/ground/gcs/src/plugins/config/images/fixedwing-shapes.svg +++ b/ground/gcs/src/plugins/config/images/fixedwing-shapes.svg @@ -487,13 +487,13 @@ inkscape:window-height="928" id="namedview4099" showgrid="false" - inkscape:zoom="1.0458791" - inkscape:cx="384.95499" - inkscape:cy="955.071" + inkscape:zoom="2.0917582" + inkscape:cx="391.2913" + inkscape:cy="1188.8255" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" - inkscape:current-layer="elevon" + inkscape:current-layer="aileron-frame" showborder="true" inkscape:showpageshadow="false" inkscape:object-paths="true" @@ -767,32 +767,7 @@ id="path4400-5-6" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:125%;font-family:Prototype;-inkscape-font-specification:Prototype;letter-spacing:0px;word-spacing:0px;fill:#ff6000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 961.2594,723.76703 q 0,-0.8 0.9106,-0.8 l 7.4667,0 q 0.9106,0 0.9106,-0.8 l 0,-8.15999 q 0,-0.8 -0.9106,-0.8 l -7.4667,0 q -0.9106,0 -0.9106,-0.8 l 0,-10 q 0,-0.8 -0.9106,-0.8 l -9.2879,0 q -0.9106,0 -0.9106,0.8 l 0,10 q 0,0.8 -0.9105,0.8 l -4.8261,0 q -0.9106,0 -0.9106,0.8 l 0,8.15999 q 0,0.8 0.9106,0.8 l 4.8261,0 q 0.9105,0 0.9105,0.8 l 0,24.96001 q 0,2.48 2.2765,4.32 q 2.2764,1.84 5.7366,1.84 l 11.4733,0 q 0.9106,0 0.9106,-0.8 l 0,-8.16 q 0,-0.72 -0.7285,-0.8 l -7.6488,0 q -0.9106,0 -0.9106,-0.8 l 0,-20.56001 z" - inkscape:connector-curvature="0" /> 1 - + Stabilized 1 - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignCenter - + Stabilized 2 - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignCenter - + Stabilized 3 - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignCenter - + Stabilized 4 - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignCenter - + Stabilized 5 - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignCenter - + Stabilized 6 - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignCenter diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlcontext.cpp b/ground/gcs/src/plugins/pfdqml/pfdqmlcontext.cpp index 9fc9b461b..329ee0511 100644 --- a/ground/gcs/src/plugins/pfdqml/pfdqmlcontext.cpp +++ b/ground/gcs/src/plugins/pfdqml/pfdqmlcontext.cpp @@ -30,41 +30,12 @@ #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" +#include "utils/stringutils.h" #include "flightbatterysettings.h" #include #include -/* - * Convert a string to lower camel case. - * Handles following cases : - * - Property -> property - * - MyProperty -> myProperty - * - MYProperty -> myProperty - * - MY_Property -> my_Property - * - MY -> my - */ -// TODO move to some utility class -QString toLowerCamelCase(const QString & name) -{ - QString str = name; - - for (int i = 0; i < str.length(); ++i) { - if (str[i].isLower() || !str[i].isLetter()) { - break; - } - if (i > 0 && i < str.length() - 1) { - // after first, look ahead one - if (str[i + 1].isLower()) { - break; - } - } - str[i] = str[i].toLower(); - } - - return str; -} - PfdQmlContext::PfdQmlContext(QObject *parent) : QObject(parent), m_speedUnit("m/s"), m_speedFactor(1.0), @@ -350,7 +321,7 @@ void PfdQmlContext::apply(QQmlContext *context) if (object) { // expose object with lower camel case name - context->setContextProperty(toLowerCamelCase(objectName), object); + context->setContextProperty(Utils::toLowerCamelCase(objectName), object); } else { qWarning() << "PfdQmlContext::apply - failed to load object" << objectName; } diff --git a/ground/gcs/src/share/qml/pfd/Compass.qml b/ground/gcs/src/share/qml/pfd/Compass.qml index 04d95eb3d..d6cf696c4 100644 --- a/ground/gcs/src/share/qml/pfd/Compass.qml +++ b/ground/gcs/src/share/qml/pfd/Compass.qml @@ -71,8 +71,7 @@ Item { rotation: -attitudeState.yaw + course_degrees transformOrigin: Item.Center - // FIXME : why test endEast twice? - visible: ((pathDesired.endEast != 0.0) && (pathDesired.endEast != 0.0)) + visible: ((pathDesired.endEast != 0.0) && (pathDesired.endNorth != 0.0)) } Item { diff --git a/ground/gcs/src/share/qml/pfd/Info.qml b/ground/gcs/src/share/qml/pfd/Info.qml index e4615be05..fc63dda8f 100644 --- a/ground/gcs/src/share/qml/pfd/Info.qml +++ b/ground/gcs/src/share/qml/pfd/Info.qml @@ -3,9 +3,9 @@ import QtQuick 2.4 import UAVTalk.HwSettings 1.0 import UAVTalk.SystemAlarms 1.0 import UAVTalk.VelocityState 1.0 -import UAVTalk.TakeOffLocation 1.0 import UAVTalk.PathDesired 1.0 import UAVTalk.WaypointActive 1.0 +import UAVTalk.TakeOffLocation 1.0 as TakeOffLocation import UAVTalk.GPSPositionSensor 1.0 as GPSPositionSensor import UAVTalk.GPSSatellites 1.0 import UAVTalk.FlightBatterySettings 1.0 @@ -479,7 +479,7 @@ Item { states: State { name: "fading" - when: (takeOffLocation.status == Status.Valid) + when: (takeOffLocation.status == TakeOffLocation.Status.Valid) PropertyChanges { target: home_bg; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; } } @@ -500,7 +500,7 @@ Item { states: State { name: "fading_heading" - when: (takeOffLocation.status == Status.Valid) + when: (takeOffLocation.status == TakeOffLocation.Status.Valid) PropertyChanges { target: home_heading_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; } } @@ -531,7 +531,7 @@ Item { states: State { name: "fading_distance" - when: (takeOffLocation.status == Status.Valid) + when: (takeOffLocation.status == TakeOffLocation.Status.Valid) PropertyChanges { target: home_distance_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; } } @@ -562,7 +562,7 @@ Item { states: State { name: "fading_distance" - when: (takeOffLocation.status == Status.Valid) + when: (takeOffLocation.status == TakeOffLocation.Status.Valid) PropertyChanges { target: home_eta_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; } } diff --git a/ground/gcs/src/share/qml/pfd/Panels.qml b/ground/gcs/src/share/qml/pfd/Panels.qml index 4ec6d0020..d85c11297 100644 --- a/ground/gcs/src/share/qml/pfd/Panels.qml +++ b/ground/gcs/src/share/qml/pfd/Panels.qml @@ -101,8 +101,7 @@ Item { // Hack : check if telemetry is active. Works with real link and log replay function telemetry_check() { - // FIXME : why rxRate + rxRate? - telemetry_sum = opLinkStatus.rxRate + opLinkStatus.rxRate + telemetry_sum = opLinkStatus.rxRate + opLinkStatus.txRate if (telemetry_sum != telemetry_sum_old || (opLinkStatus.linkState == LinkState.Connected)) { telemetry_link = 1 diff --git a/package/linux/deb.mk b/package/linux/deb.mk index a7229b818..e862fc87c 100644 --- a/package/linux/deb.mk +++ b/package/linux/deb.mk @@ -8,6 +8,7 @@ DEB_REV := 0$(DEB_DIST)1 endif DEB_NAME := $(ORG_SMALL_NAME) DEB_ORIG_SRC := $(PACKAGE_DIR)/$(DEB_NAME)_$(UPSTREAM_VER).orig.tar.gz +DEB_ORIG_FW := $(PACKAGE_DIR)/$(DEB_NAME)_$(UPSTREAM_VER).orig-firmware.tar.gz DEB_PACKAGE_DIR := $(PACKAGE_DIR)/$(DEB_NAME)-$(UPSTREAM_VER) DEB_ARCH := $(shell dpkg --print-architecture) DEB_PACKAGE_NAME := $(DEB_NAME)_$(UPSTREAM_VER)-$(DEB_REV)_$(DEB_ARCH) @@ -39,6 +40,7 @@ PACKAGE_DEPS_SED := s/python.*/python/;s/{misc:Depends}.*/{misc:Depends}/; package: debian @$(ECHO) "Building Linux package, please wait..." $(V1) sed -i -e "$(PACKAGE_DEPS_SED)" debian/control + $(V1) sed -i -e 's/WITH_PREBUILT.*firmware//' debian/rules $(V1) dpkg-buildpackage -b -us -uc -nc $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(BUILD_DIR) $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(BUILD_DIR) @@ -61,8 +63,12 @@ package_src: $(DEB_ORIG_SRC_NAME) $(DEB_PACKAGE_DIR) $(DEB_ORIG_SRC): $(DIST_TAR_GZ) | $(PACKAGE_DIR) $(V1) cp $(DIST_TAR_GZ) $(DEB_ORIG_SRC) -$(DEB_PACKAGE_DIR): $(DEB_ORIG_SRC) debian | $(PACKAGE_DIR) +$(DEB_ORIG_FW): $(FW_DIST_TAR_GZ) | $(PACKAGE_DIR) + $(V1) cp $(FW_DIST_TAR_GZ) $(DEB_ORIG_FW) + +$(DEB_PACKAGE_DIR): $(DEB_ORIG_SRC) $(DEB_ORIG_FW) debian | $(PACKAGE_DIR) $(V1) tar -xf $(DEB_ORIG_SRC) -C $(PACKAGE_DIR) + $(V1) tar -xf $(DEB_ORIG_FW) -C $(PACKAGE_DIR)/$(PACKAGE_NAME) $(V1) mv debian $(PACKAGE_DIR)/$(PACKAGE_NAME) $(V1) rm -rf $(DEB_PACKAGE_DIR) && mv $(PACKAGE_DIR)/$(PACKAGE_NAME) $(DEB_PACKAGE_DIR) diff --git a/package/linux/debian/control b/package/linux/debian/control index 64ee9e6c9..96a668ddd 100644 --- a/package/linux/debian/control +++ b/package/linux/debian/control @@ -2,7 +2,7 @@ Source: Section: electronics Priority: optional Maintainer: The LibrePilot Project <> -Build-Depends: debhelper (>= 9), libudev-dev, libusb-1.0-0-dev, libsdl1.2-dev, python, gcc-arm-none-eabi (>=4.9), qt5-default, qttools5-dev-tools, libqt5svg5-dev, qtdeclarative5-dev, qml-module-qtquick-controls, libqt5serialport5-dev, qtmultimedia5-dev, qtscript5-dev, libqt5opengl5-dev +Build-Depends: debhelper (>= 9), libudev-dev, libusb-1.0-0-dev, libsdl1.2-dev, python, qt5-default, qttools5-dev-tools, libqt5svg5-dev, qtdeclarative5-dev, qml-module-qtquick-controls, libqt5serialport5-dev, qtmultimedia5-dev, qtscript5-dev, libqt5opengl5-dev Standards-Version: 3.9.5 Homepage: Vcs-Git: diff --git a/package/linux/debian/rules b/package/linux/debian/rules index 6b2ce35ee..4f29ac36e 100755 --- a/package/linux/debian/rules +++ b/package/linux/debian/rules @@ -12,7 +12,7 @@ export DH_OPTIONS dh $@ override_dh_auto_build: - dh_auto_build -- opfw_resource gcs + dh_auto_build -- WITH_PREBUILT_FW=$(CURDIR)/firmware opfw_resource gcs override_dh_auto_install: dh_auto_install -- prefix=/usr