1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

Merge remote-tracking branch 'upstream/next' into filnet/LP-29_osgearth_integration

# Conflicts:
#	ground/gcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp
#	ground/gcs/src/share/qml/pfd/Compass.qml
#	ground/gcs/src/share/qml/pfd/Info.qml
#	ground/gcs/src/share/qml/pfd/Panels.qml
#	ground/gcs/src/share/qml/pfd/VsiScale.qml
#	ground/gcs/src/share/qml/pfd/Warnings.qml
This commit is contained in:
Philippe Renon 2015-12-08 01:22:12 +01:00
commit f9694acfd1
23 changed files with 910 additions and 187 deletions

View File

@ -30,9 +30,10 @@ Links for the LibrePilot Project
- [Main project web site](https://www.librepilot.org) - [Main project web site](https://www.librepilot.org)
- [Project forums](https://forum.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) - [Source code repository](https://bitbucket.org/librepilot)
- [Mirror](https://github.com/librepilot) - [Mirror](https://github.com/librepilot)
- [Issue tracker](https://librepilot.atlassian.net) - [Issue tracker](https://librepilot.atlassian.net)
- [Gitter Chat](https://gitter.im/librepilot/LibrePilot) - [Gitter Chat](https://gitter.im/librepilot/LibrePilot)
- IRC: #LibrePilot on FreeNode - IRC: #LibrePilot on FreeNode

View File

@ -100,30 +100,35 @@
#ifdef PIOS_INCLUDE_RFM22B #ifdef PIOS_INCLUDE_RFM22B
#define HAS_RADIO #define HAS_RADIO
#endif #endif
// Private types // Private types
typedef struct { typedef struct {
// Determine port on which to communicate telemetry information // Determine port on which to communicate telemetry information
uint32_t (*getPort)(); uint32_t (*getPort)();
// Main telemetry queue // Main telemetry queue
xQueueHandle queue; xQueueHandle queue;
#ifdef PIOS_TELEM_PRIORITY_QUEUE #ifdef PIOS_TELEM_PRIORITY_QUEUE
// Priority telemetry queue // Priority telemetry queue
xQueueHandle priorityQueue; xQueueHandle priorityQueue;
#endif /* PIOS_TELEM_PRIORITY_QUEUE */ #endif /* PIOS_TELEM_PRIORITY_QUEUE */
// Transmit/receive task handles // Transmit/receive task handles
xTaskHandle txTaskHandle; xTaskHandle txTaskHandle;
xTaskHandle rxTaskHandle; xTaskHandle rxTaskHandle;
// Telemetry stream // Telemetry stream
UAVTalkConnection uavTalkCon; UAVTalkConnection uavTalkCon;
} channelContext; } channelContext;
#ifdef HAS_RADIO #ifdef HAS_RADIO
// Main telemetry channel // Main telemetry channel
static channelContext localChannel; static channelContext localChannel;
static int32_t transmitLocalData(uint8_t *data, int32_t length); static int32_t transmitLocalData(uint8_t *data, int32_t length);
static void registerLocalObject(UAVObjHandle obj); static void registerLocalObject(UAVObjHandle obj);
static uint32_t localPort(); static uint32_t localPort();
#endif /* ifdef HAS_RADIO */
static void updateSettings(channelContext *channel); static void updateSettings(channelContext *channel);
#endif
// OPLink telemetry channel // OPLink telemetry channel
static channelContext radioChannel; static channelContext radioChannel;
@ -165,6 +170,7 @@ static void gcsTelemetryStatsUpdated();
*/ */
int32_t TelemetryStart(void) int32_t TelemetryStart(void)
{ {
#ifdef HAS_RADIO #ifdef HAS_RADIO
// Only start the local telemetry tasks if needed // Only start the local telemetry tasks if needed
if (localPort()) { if (localPort()) {
@ -195,6 +201,7 @@ int32_t TelemetryStart(void)
localChannel.rxTaskHandle); localChannel.rxTaskHandle);
} }
#endif /* ifdef HAS_RADIO */ #endif /* ifdef HAS_RADIO */
// Start the telemetry tasks associated with Radio/USB // Start the telemetry tasks associated with Radio/USB
UAVObjIterate(&registerRadioObject); UAVObjIterate(&registerRadioObject);
@ -231,6 +238,7 @@ void TelemetryInitializeChannel(channelContext *channel)
// Create object queues // Create object queues
channel->queue = xQueueCreate(MAX_QUEUE_SIZE, channel->queue = xQueueCreate(MAX_QUEUE_SIZE,
sizeof(UAVObjEvent)); sizeof(UAVObjEvent));
#if defined(PIOS_TELEM_PRIORITY_QUEUE) #if defined(PIOS_TELEM_PRIORITY_QUEUE)
channel->priorityQueue = xQueueCreate(MAX_QUEUE_SIZE, channel->priorityQueue = xQueueCreate(MAX_QUEUE_SIZE,
sizeof(UAVObjEvent)); sizeof(UAVObjEvent));
@ -283,6 +291,7 @@ int32_t TelemetryInitialize(void)
// Reset link stats // Reset link stats
txErrors = 0; txErrors = 0;
txRetries = 0; txRetries = 0;
#ifdef HAS_RADIO #ifdef HAS_RADIO
// Set channel port handlers // Set channel port handlers
localChannel.getPort = localPort; localChannel.getPort = localPort;
@ -297,10 +306,14 @@ int32_t TelemetryInitialize(void)
// Initialise UAVTalk // Initialise UAVTalk
localChannel.uavTalkCon = UAVTalkInitialize(&transmitLocalData); localChannel.uavTalkCon = UAVTalkInitialize(&transmitLocalData);
} }
#endif /* ifdef HAS_RADIO */
#endif
// Set channel port handlers // Set channel port handlers
radioChannel.getPort = radioPort; radioChannel.getPort = radioPort;
// Set the channel port baud rate
updateSettings(&radioChannel);
// Initialise channel // Initialise channel
TelemetryInitializeChannel(&radioChannel); TelemetryInitializeChannel(&radioChannel);
// Initialise UAVTalk // Initialise UAVTalk
@ -310,6 +323,7 @@ int32_t TelemetryInitialize(void)
} }
MODULE_INITCALL(TelemetryInitialize, TelemetryStart); MODULE_INITCALL(TelemetryInitialize, TelemetryStart);
#ifdef HAS_RADIO #ifdef HAS_RADIO
/** /**
* Register a new object, adds object to local list and connects the queue depending on the object's * 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); EV_NONE);
} }
} }
#endif #endif /* ifdef HAS_RADIO */
static void registerRadioObject(UAVObjHandle obj) static void registerRadioObject(UAVObjHandle obj)
{ {
if (UAVObjIsMetaobject(obj)) { if (UAVObjIsMetaobject(obj)) {
@ -459,6 +474,7 @@ static void updateObject(
UAVObjConnectQueue(obj, channel->priorityQueue, eventMask); UAVObjConnectQueue(obj, channel->priorityQueue, eventMask);
} else } else
#endif /* PIOS_TELEM_PRIORITY_QUEUE */ #endif /* PIOS_TELEM_PRIORITY_QUEUE */
UAVObjConnectQueue(obj, channel->queue, eventMask); 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 * Tries to empty the high priority queue before handling any standard priority item
*/ */
#ifdef PIOS_TELEM_PRIORITY_QUEUE #ifdef PIOS_TELEM_PRIORITY_QUEUE
// empty priority queue, non-blocking // empty priority queue, non-blocking
while (xQueueReceive(channel->priorityQueue, &ev, 0) == pdTRUE) { while (xQueueReceive(channel->priorityQueue, &ev, 0) == pdTRUE) {
@ -606,6 +623,7 @@ static void telemetryTxTask(void *parameters)
processObjEvent(channel, &ev); processObjEvent(channel, &ev);
} }
#endif /* PIOS_TELEM_PRIORITY_QUEUE */ #endif /* PIOS_TELEM_PRIORITY_QUEUE */
} }
} }
@ -650,7 +668,8 @@ static uint32_t localPort()
{ {
return PIOS_COM_TELEM_RF; return PIOS_COM_TELEM_RF;
} }
#endif
#endif /* ifdef HAS_RADIO */
/** /**
* Determine the port to be used for communication on the radio channel * 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; return -1;
} }
#endif #endif /* ifdef HAS_RADIO */
/** /**
* Transmit data buffer to the radioport. * Transmit data buffer to the radioport.
@ -811,9 +830,11 @@ static void updateTelemetryStats()
// Get stats // Get stats
UAVTalkGetStats(radioChannel.uavTalkCon, &utalkStats, true); UAVTalkGetStats(radioChannel.uavTalkCon, &utalkStats, true);
#ifdef HAS_RADIO #ifdef HAS_RADIO
UAVTalkAddStats(localChannel.uavTalkCon, &utalkStats, true); UAVTalkAddStats(localChannel.uavTalkCon, &utalkStats, true);
#endif #endif
// Get object data // Get object data
FlightTelemetryStatsGet(&flightStats); FlightTelemetryStatsGet(&flightStats);
GCSTelemetryStatsGet(&gcsStats); GCSTelemetryStatsGet(&gcsStats);
@ -895,7 +916,6 @@ static void updateTelemetryStats()
} }
} }
#ifdef HAS_RADIO
/** /**
* Update the telemetry settings, called on startup. * Update the telemetry settings, called on startup.
* FIXME: This should be in the TelemetrySettings object. But objects * FIXME: This should be in the TelemetrySettings object. But objects
@ -939,7 +959,6 @@ static void updateSettings(channelContext *channel)
} }
} }
#endif /* ifdef HAS_RADIO */
/** /**
* @} * @}
* @} * @}

View File

@ -1,13 +1,11 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file settingsutils.cpp * @file pathutils.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. * @brief String utilities
* @brief *
* @see The GNU Public License (GPL) Version 3 * @see The GNU Public License (GPL) Version 3
* @defgroup
* @{
* *
*****************************************************************************/ *****************************************************************************/
/* /*
@ -26,23 +24,26 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "settingsutils.h" #include "stringutils.h"
#include <QtCore/QString>
namespace Utils { namespace Utils {
QTCREATOR_UTILS_EXPORT QString settingsKey(const QString &category) QString toLowerCamelCase(const QString & name)
{ {
QString rc(category); QString str = name;
const QChar underscore = QLatin1Char('_');
const int size = rc.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < str.length(); ++i) {
const QChar c = rc.at(i); if (str[i].isLower() || !str[i].isLetter()) {
if (!c.isLetterOrNumber() && c != underscore) { break;
rc[i] = underscore;
} }
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

View File

@ -1,8 +1,8 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file settingsutils.h * @file stringutils.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009. * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @brief * @brief
* @see The GNU Public License (GPL) Version 3 * @see The GNU Public License (GPL) Version 3
@ -26,15 +26,24 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef SETTINGSTUTILS_H #ifndef STRINGUTILS_H
#define SETTINGSTUTILS_H #define STRINGUTILS_H
#include "utils_global.h" #include "utils_global.h"
namespace Utils { #include <QString>
// Create a usable settings key from a category,
// for example Editor|C++ -> Editor_C__
QTCREATOR_UTILS_EXPORT QString settingsKey(const QString &category);
} // namespace Utils
#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 */

View File

@ -13,7 +13,7 @@ DEFINES += PLUGIN_REL_PATH=$$shell_quote(\"$$relative_path($$GCS_PLUGIN_PATH, $$
SOURCES += \ SOURCES += \
reloadpromptutils.cpp \ reloadpromptutils.cpp \
settingsutils.cpp \ stringutils.cpp \
filesearch.cpp \ filesearch.cpp \
pathchooser.cpp \ pathchooser.cpp \
pathlisteditor.cpp \ pathlisteditor.cpp \
@ -59,6 +59,7 @@ SOURCES += \
mustache.cpp \ mustache.cpp \
textbubbleslider.cpp textbubbleslider.cpp
SOURCES += xmlconfig.cpp SOURCES += xmlconfig.cpp
win32 { win32 {
@ -73,7 +74,7 @@ else:SOURCES += consoleprocess_unix.cpp
HEADERS += \ HEADERS += \
utils_global.h \ utils_global.h \
reloadpromptutils.h \ reloadpromptutils.h \
settingsutils.h \ stringutils.h \
filesearch.h \ filesearch.h \
listutils.h \ listutils.h \
pathchooser.h \ pathchooser.h \

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>880</width> <width>920</width>
<height>608</height> <height>690</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -66,8 +66,8 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>10</width> <width>250</width>
<height>10</height> <height>250</height>
</size> </size>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
@ -130,8 +130,8 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>10</width> <width>250</width>
<height>10</height> <height>250</height>
</size> </size>
</property> </property>
<property name="sizeIncrement"> <property name="sizeIncrement">
@ -514,7 +514,7 @@ margin:1px;</string>
<property name="title"> <property name="title">
<string>Output Channel Assignments</string> <string>Output Channel Assignments</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_7" columnstretch="1,1"> <layout class="QGridLayout" name="gridLayout_7" columnstretch="1,1,0,0">
<property name="leftMargin"> <property name="leftMargin">
<number>9</number> <number>9</number>
</property> </property>
@ -538,42 +538,6 @@ margin:1px;</string>
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>6</number> <number>6</number>
</property> </property>
<item row="0" column="0">
<widget class="QLabel" name="fwElevator2Label">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</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>Elevator 2</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="fwElevator2ChannelBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Assign your output channel</string>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="fwRudder1Label"> <widget class="QLabel" name="fwRudder1Label">
<property name="minimumSize"> <property name="minimumSize">
@ -755,8 +719,458 @@ margin:1px;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QLabel" name="fwElevator2Label">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</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>Elevator 2</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="fwElevator2ChannelBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Assign your output channel</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="0" column="3" rowspan="2">
<layout class="QGridLayout" name="gridLayout_4" columnstretch="0,0,0,0" columnminimumwidth="0,0,0,0">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<item row="2" column="3">
<widget class="QComboBox" name="rcOutputCurveBoxFw2">
<property name="toolTip">
<string>Select output curve for Accessory1 RcInput</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="rcOutputChannelBoxFw1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory0 RcInput</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</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>Accessory0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>90</width>
<height>16</height>
</size>
</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>RC Input</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</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>Accessory1</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>110</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>RcOutput channels</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>RC Output 1</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="rcOutputChannelBoxFw3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory2 RcInput</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="rcOutputChannelBoxFw2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory1 RcInput</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_14">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</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>Accessory2</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_15">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>RcOutput curve</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>Curve</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QComboBox" name="rcOutputCurveBoxFw1">
<property name="toolTip">
<string>Select output curve for Accessory0 RcInput</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QComboBox" name="rcOutputCurveBoxFw4">
<property name="toolTip">
<string>Select output curve for Accessory3 RcInput</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QComboBox" name="rcOutputCurveBoxFw3">
<property name="toolTip">
<string>Select output curve for Accessory2 RcInput</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_16">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</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>Accessory3</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="rcOutputChannelBoxFw4">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory3 RcInput</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>110</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>RcOutput channels</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>RC Output 2</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="rcOutputChannelBoxFw1_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory0 RcInput</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="rcOutputChannelBoxFw2_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory1 RcInput</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="rcOutputChannelBoxFw3_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory2 RcInput</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QComboBox" name="rcOutputChannelBoxFw4_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory3 RcInput</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2" rowspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -51,7 +51,8 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions()
} }
// get the gui config data // get the gui config data
GUIConfigDataUnion configData = getConfigData(); GUIConfigDataUnion configData = getConfigData();
fixedGUISettingsStruct fixedwing = configData.fixedwing;
if (configData.fixedwing.FixedWingPitch1 > 0) { if (configData.fixedwing.FixedWingPitch1 > 0) {
channelDesc[configData.fixedwing.FixedWingPitch1 - 1] = QString("FixedWingPitch1"); channelDesc[configData.fixedwing.FixedWingPitch1 - 1] = QString("FixedWingPitch1");
@ -74,6 +75,33 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions()
if (configData.fixedwing.FixedWingThrottle > 0) { if (configData.fixedwing.FixedWingThrottle > 0) {
channelDesc[configData.fixedwing.FixedWingThrottle - 1] = QString("FixedWingThrottle"); 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; return channelDesc;
} }
@ -84,6 +112,13 @@ ConfigFixedWingWidget::ConfigFixedWingWidget(QWidget *parent) :
populateChannelComboBoxes(); 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; QStringList fixedWingTypes;
fixedWingTypes << "Aileron" << "Elevon" << "Vtail"; fixedWingTypes << "Aileron" << "Elevon" << "Vtail";
m_aircraft->fixedWingType->addItems(fixedWingTypes); m_aircraft->fixedWingType->addItems(fixedWingTypes);
@ -238,6 +273,18 @@ void ConfigFixedWingWidget::registerWidgets(ConfigTaskWidget &parent)
parent.addWidget(m_aircraft->elevonSlider1); parent.addWidget(m_aircraft->elevonSlider1);
parent.addWidget(m_aircraft->elevonSlider2); parent.addWidget(m_aircraft->elevonSlider2);
parent.addWidget(m_aircraft->elevonSlider3); 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) void ConfigFixedWingWidget::resetActuators(GUIConfigDataUnion *configData)
@ -251,6 +298,44 @@ void ConfigFixedWingWidget::resetActuators(GUIConfigDataUnion *configData)
configData->fixedwing.FixedWingThrottle = 0; 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<UAVDataObject *>(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 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->fwRudder1ChannelBox, fixed.FixedWingYaw1);
setComboCurrentIndex(m_aircraft->fwRudder2ChannelBox, fixed.FixedWingYaw2); 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) // Get mixing values for GUI sliders (values stored onboard)
m_aircraft->elevonSlider3->setValue(getMixerValue(mixer, "RollDifferential")); m_aircraft->elevonSlider3->setValue(getMixerValue(mixer, "RollDifferential"));
if (frameType == "FixedWingElevon" || frameType == "Elevon") { if (frameType == "FixedWingElevon" || frameType == "Elevon") {
@ -310,6 +407,13 @@ QString ConfigFixedWingWidget::updateConfigObjectsFromWidgets()
Q_ASSERT(mixer); Q_ASSERT(mixer);
// Reset all Mixers type
resetAllMixersType(mixer);
QList<QString> rcOutputList;
rcOutputList << "Accessory0" << "Accessory1" << "Accessory2" << "Accessory3";
setupRcOutputs(rcOutputList);
// Set the throttle curve // Set the throttle curve
setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->fixedWingThrottle->getCurve()); setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->fixedWingThrottle->getCurve());
@ -580,6 +684,118 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType)
return true; return true;
} }
/**
Helper function: setup rc outputs. Takes a list of channel names in input.
*/
void ConfigFixedWingWidget::setupRcOutputs(QList<QString> rcOutputList)
{
QList<QComboBox *> rcList;
rcList << m_aircraft->rcOutputChannelBoxFw1 << m_aircraft->rcOutputChannelBoxFw2
<< m_aircraft->rcOutputChannelBoxFw3 << m_aircraft->rcOutputChannelBoxFw4;
QList<QComboBox *> 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<UAVDataObject *>(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) void ConfigFixedWingWidget::enableControls(bool enable)
{ {
ConfigTaskWidget::enableControls(enable); ConfigTaskWidget::enableControls(enable);
@ -648,6 +864,44 @@ bool ConfigFixedWingWidget::throwConfigError(QString airframeType)
channelNames += (combobox->currentText() == "None") ? "" : combobox->currentText(); 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<QComboBox *>("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<QComboBox *>("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; return error;
} }

View File

@ -58,10 +58,13 @@ private:
virtual void registerWidgets(ConfigTaskWidget &parent); virtual void registerWidgets(ConfigTaskWidget &parent);
virtual void resetActuators(GUIConfigDataUnion *configData); virtual void resetActuators(GUIConfigDataUnion *configData);
virtual void resetRcOutputs(GUIConfigDataUnion *configData);
bool setupFrameFixedWing(QString airframeType); bool setupFrameFixedWing(QString airframeType);
bool setupFrameElevon(QString airframeType); bool setupFrameElevon(QString airframeType);
bool setupFrameVtail(QString airframeType); bool setupFrameVtail(QString airframeType);
void setupRcOutputs(QList<QString> rcOutputList);
void updateRcCurvesUsed();
protected: protected:
void enableControls(bool enable); void enableControls(bool enable);

View File

@ -373,18 +373,6 @@ void ConfigMultiRotorWidget::resetRcOutputs(GUIConfigDataUnion *configData)
configData->multi.Accessory3 = 0; configData->multi.Accessory3 = 0;
} }
void ConfigMultiRotorWidget::resetMixers()
{
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(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() void ConfigMultiRotorWidget::updateRcCurvesUsed()
{ {
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings"))); UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
@ -545,8 +533,8 @@ QString ConfigMultiRotorWidget::updateConfigObjectsFromWidgets()
Q_ASSERT(mixer); Q_ASSERT(mixer);
// Reset all Mixers // Reset all Mixers types
resetMixers(); resetAllMixersType(mixer);
QList<QString> rcOutputList; QList<QString> rcOutputList;
rcOutputList << "Accessory0" << "Accessory1" << "Accessory2" << "Accessory3"; rcOutputList << "Accessory0" << "Accessory1" << "Accessory2" << "Accessory3";

View File

@ -73,7 +73,6 @@ private:
bool setupMultiRotorMixer(double mixerFactors[8][3]); bool setupMultiRotorMixer(double mixerFactors[8][3]);
void setupMotors(QList<QString> motorList); void setupMotors(QList<QString> motorList);
void setupRcOutputs(QList<QString> rcOutputList); void setupRcOutputs(QList<QString> rcOutputList);
void resetMixers();
void setupQuadMotor(int channel, double roll, double pitch, double yaw); void setupQuadMotor(int channel, double roll, double pitch, double yaw);
void setYawMixLevel(int); void setYawMixLevel(int);

View File

@ -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) double VehicleConfig::getMixerVectorValue(UAVDataObject *mixer, int channel, MixerVectorElem elementName)
{ {
Q_ASSERT(mixer); Q_ASSERT(mixer);

View File

@ -89,10 +89,17 @@ typedef struct {
uint FixedWingPitch2 : 4; uint FixedWingPitch2 : 4;
uint FixedWingYaw1 : 4; uint FixedWingYaw1 : 4;
uint FixedWingYaw2 : 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 padding1;
quint32 padding2; quint32 padding2; // 128 bits
quint32 padding3; // 128 bits
} __attribute__((packed)) fixedGUISettingsStruct; } __attribute__((packed)) fixedGUISettingsStruct;
typedef struct { typedef struct {
@ -228,6 +235,7 @@ protected:
void setMixerVectorValue(UAVDataObject *mixer, int channel, MixerVectorElem elementName, double value); void setMixerVectorValue(UAVDataObject *mixer, int channel, MixerVectorElem elementName, double value);
void resetMixerVector(UAVDataObject *mixer, int channel); void resetMixerVector(UAVDataObject *mixer, int channel);
void resetMotorAndServoMixers(UAVDataObject *mixer); void resetMotorAndServoMixers(UAVDataObject *mixer);
void resetAllMixersType(UAVDataObject *mixer);
QString getMixerType(UAVDataObject *mixer, int channel); QString getMixerType(UAVDataObject *mixer, int channel);
void setMixerType(UAVDataObject *mixer, int channel, MixerTypeElem mixerType); void setMixerType(UAVDataObject *mixer, int channel, MixerTypeElem mixerType);
void setThrottleCurve(UAVDataObject *mixer, MixerThrottleCurveElem curveType, QList<double> curve); void setThrottleCurve(UAVDataObject *mixer, MixerThrottleCurveElem curveType, QList<double> curve);

View File

@ -1645,6 +1645,46 @@ void ConfigInputWidget::moveFMSlider()
pos = manualSettingsDataPriv.FlightModeNumber - 1; pos = manualSettingsDataPriv.FlightModeNumber - 1;
} }
ui->fmsSlider->setValue(pos); ui->fmsSlider->setValue(pos);
highlightStabilizationMode(pos);
}
void ConfigInputWidget::highlightStabilizationMode(int pos)
{
QComboBox *comboboxFm = this->findChild<QComboBox *>("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<QLabel *>("stab" + QString::number(i + 1) + "_label");
QComboBox *comboRoll = this->findChild<QComboBox *>("fmsSsPos" + QString::number(i + 1) + "Roll");
QComboBox *comboPitch = this->findChild<QComboBox *>("fmsSsPos" + QString::number(i + 1) + "Pitch");
QComboBox *comboYaw = this->findChild<QComboBox *>("fmsSsPos" + QString::number(i + 1) + "Yaw");
QComboBox *comboThrust = this->findChild<QComboBox *>("fmsSsPos" + QString::number(i + 1) + "Thrust");
QComboBox *comboboxFm2 = this->findChild<QComboBox *>("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() void ConfigInputWidget::updatePositionSlider()

View File

@ -202,6 +202,8 @@ private:
AccessoryDesired *getAccessoryDesiredInstance(int instance); AccessoryDesired *getAccessoryDesiredInstance(int instance);
float getAccessoryDesiredValue(int instance); float getAccessoryDesiredValue(int instance);
void highlightStabilizationMode(int pos);
private slots: private slots:
void wzNext(); void wzNext();
void wzNextDelayed(); void wzNextDelayed();

View File

@ -487,13 +487,13 @@
inkscape:window-height="928" inkscape:window-height="928"
id="namedview4099" id="namedview4099"
showgrid="false" showgrid="false"
inkscape:zoom="1.0458791" inkscape:zoom="2.0917582"
inkscape:cx="384.95499" inkscape:cx="391.2913"
inkscape:cy="955.071" inkscape:cy="1188.8255"
inkscape:window-x="0" inkscape:window-x="0"
inkscape:window-y="27" inkscape:window-y="27"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:current-layer="elevon" inkscape:current-layer="aileron-frame"
showborder="true" showborder="true"
inkscape:showpageshadow="false" inkscape:showpageshadow="false"
inkscape:object-paths="true" inkscape:object-paths="true"
@ -767,32 +767,7 @@
id="path4400-5-6" 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" 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" 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" /></g></g></g><g inkscape:connector-curvature="0" /></g></g></g><rect
transform="translate(0.31998545,1013.9245)"
id="aileron-rudder-top"
style="fill:#ffffff;fill-opacity:1"><path
id="path3769"
d="m 398.002,892.888 c -0.523,-9.188 -0.92,-18.377 -1.326,-27.563 l -0.547,-13.783 -0.447,-13.782 c -0.135,-4.594 -0.416,-9.188 -0.63,-13.783 -0.213,-4.595 -0.231,-9.188 -0.033,-13.78 0.194,-4.597 0.512,-9.189 0.972,-13.782 0.475,-4.596 1.061,-9.189 2.012,-13.784 0.055,-0.267 0.248,-0.42 0.432,-0.339 0.114,0.053 0.197,0.184 0.23,0.339 0.951,4.595 1.537,9.188 2.012,13.784 0.46,4.593 0.776,9.188 0.974,13.782 0.195,4.594 0.18,9.188 -0.033,13.78 -0.215,4.596 -0.496,9.189 -0.631,13.783 l -0.446,13.782 -0.547,13.783 c -0.406,9.188 -0.803,18.378 -1.326,27.563 -0.016,0.271 -0.176,0.469 -0.359,0.445 -0.168,-0.02 -0.294,-0.213 -0.307,-0.445 z"
stroke-miterlimit="10"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.64670002;stroke-miterlimit:10" /><path
id="path3771"
d="m 398.166,894.704 c -0.264,-3.729 -0.464,-7.455 -0.668,-11.188 l -0.276,-5.591 -0.225,-5.593 c -0.068,-1.863 -0.21,-3.728 -0.317,-5.592 -0.106,-1.864 -0.114,-3.729 -0.017,-5.592 0.098,-1.864 0.258,-3.729 0.49,-5.594 0.236,-1.862 0.532,-3.729 1.014,-5.593 0.027,-0.104 0.125,-0.171 0.217,-0.139 0.061,0.021 0.103,0.075 0.117,0.139 0.479,1.863 0.774,3.729 1.014,5.593 0.232,1.863 0.395,3.729 0.49,5.594 0.102,1.862 0.09,3.728 -0.018,5.592 -0.108,1.864 -0.248,3.729 -0.317,5.592 l -0.226,5.593 -0.275,5.591 c -0.205,3.73 -0.404,7.457 -0.668,11.188 -0.008,0.105 -0.089,0.188 -0.182,0.18 -0.083,-0.008 -0.147,-0.086 -0.153,-0.18 z"
stroke-miterlimit="10"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.48500001;stroke-miterlimit:10" /><path
id="path3773"
d="m 398.278,872.009 c -0.162,-0.874 -0.284,-1.749 -0.409,-2.623 l -0.169,-1.313 -0.138,-1.313 c -0.041,-0.438 -0.131,-0.874 -0.194,-1.312 -0.065,-0.438 -0.071,-0.874 -0.01,-1.313 0.06,-0.438 0.155,-0.875 0.3,-1.311 0.146,-0.438 0.326,-0.877 0.62,-1.313 0.017,-0.024 0.074,-0.041 0.133,-0.032 0.035,0.007 0.062,0.019 0.071,0.032 0.293,0.438 0.474,0.874 0.619,1.313 0.143,0.436 0.238,0.873 0.301,1.311 0.061,0.438 0.056,0.874 -0.012,1.313 -0.064,0.438 -0.151,0.875 -0.193,1.312 l -0.14,1.313 -0.169,1.313 c -0.125,0.874 -0.246,1.749 -0.406,2.623 -0.006,0.025 -0.057,0.045 -0.11,0.043 -0.052,-0.002 -0.09,-0.021 -0.094,-0.043 z"
stroke-miterlimit="10"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.3233;stroke-miterlimit:10" /><line
id="line3775"
y2="801.84399"
x2="400.82199"
y1="801.78497"
x1="395.849"
stroke-miterlimit="10"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.51120001;stroke-miterlimit:10" /></g><rect
style="fill:url(#linearGradient9561);fill-opacity:1;stroke:#010101;stroke-width:0.69120002;stroke-linecap:round;stroke-linejoin:round" style="fill:url(#linearGradient9561);fill-opacity:1;stroke:#010101;stroke-width:0.69120002;stroke-linecap:round;stroke-linejoin:round"
x="316.569" x="316.569"
y="1874.4409" y="1874.4409"
@ -1416,7 +1391,32 @@
d="M 231.089,661.657 V 636.359" d="M 231.089,661.657 V 636.359"
id="path8516_1_" id="path8516_1_"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
style="fill:none;stroke:#010101;stroke-width:0.69520003;stroke-linecap:round;stroke-linejoin:round" /></g></g></g><g style="fill:none;stroke:#010101;stroke-width:0.69520003;stroke-linecap:round;stroke-linejoin:round" /></g><g
transform="translate(0.31998545,1013.9245)"
id="aileron-rudder-top"
style="fill:#ffffff;fill-opacity:1"><path
id="path3769"
d="m 398.002,892.888 c -0.523,-9.188 -0.92,-18.377 -1.326,-27.563 l -0.547,-13.783 -0.447,-13.782 c -0.135,-4.594 -0.416,-9.188 -0.63,-13.783 -0.213,-4.595 -0.231,-9.188 -0.033,-13.78 0.194,-4.597 0.512,-9.189 0.972,-13.782 0.475,-4.596 1.061,-9.189 2.012,-13.784 0.055,-0.267 0.248,-0.42 0.432,-0.339 0.114,0.053 0.197,0.184 0.23,0.339 0.951,4.595 1.537,9.188 2.012,13.784 0.46,4.593 0.776,9.188 0.974,13.782 0.195,4.594 0.18,9.188 -0.033,13.78 -0.215,4.596 -0.496,9.189 -0.631,13.783 l -0.446,13.782 -0.547,13.783 c -0.406,9.188 -0.803,18.378 -1.326,27.563 -0.016,0.271 -0.176,0.469 -0.359,0.445 -0.168,-0.02 -0.294,-0.213 -0.307,-0.445 z"
stroke-miterlimit="10"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.64670002;stroke-miterlimit:10" /><path
id="path3771"
d="m 398.166,894.704 c -0.264,-3.729 -0.464,-7.455 -0.668,-11.188 l -0.276,-5.591 -0.225,-5.593 c -0.068,-1.863 -0.21,-3.728 -0.317,-5.592 -0.106,-1.864 -0.114,-3.729 -0.017,-5.592 0.098,-1.864 0.258,-3.729 0.49,-5.594 0.236,-1.862 0.532,-3.729 1.014,-5.593 0.027,-0.104 0.125,-0.171 0.217,-0.139 0.061,0.021 0.103,0.075 0.117,0.139 0.479,1.863 0.774,3.729 1.014,5.593 0.232,1.863 0.395,3.729 0.49,5.594 0.102,1.862 0.09,3.728 -0.018,5.592 -0.108,1.864 -0.248,3.729 -0.317,5.592 l -0.226,5.593 -0.275,5.591 c -0.205,3.73 -0.404,7.457 -0.668,11.188 -0.008,0.105 -0.089,0.188 -0.182,0.18 -0.083,-0.008 -0.147,-0.086 -0.153,-0.18 z"
stroke-miterlimit="10"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.48500001;stroke-miterlimit:10" /><path
id="path3773"
d="m 398.278,872.009 c -0.162,-0.874 -0.284,-1.749 -0.409,-2.623 l -0.169,-1.313 -0.138,-1.313 c -0.041,-0.438 -0.131,-0.874 -0.194,-1.312 -0.065,-0.438 -0.071,-0.874 -0.01,-1.313 0.06,-0.438 0.155,-0.875 0.3,-1.311 0.146,-0.438 0.326,-0.877 0.62,-1.313 0.017,-0.024 0.074,-0.041 0.133,-0.032 0.035,0.007 0.062,0.019 0.071,0.032 0.293,0.438 0.474,0.874 0.619,1.313 0.143,0.436 0.238,0.873 0.301,1.311 0.061,0.438 0.056,0.874 -0.012,1.313 -0.064,0.438 -0.151,0.875 -0.193,1.312 l -0.14,1.313 -0.169,1.313 c -0.125,0.874 -0.246,1.749 -0.406,2.623 -0.006,0.025 -0.057,0.045 -0.11,0.043 -0.052,-0.002 -0.09,-0.021 -0.094,-0.043 z"
stroke-miterlimit="10"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.3233;stroke-miterlimit:10" /><line
id="line3775"
y2="801.84399"
x2="400.82199"
y1="801.78497"
x1="395.849"
stroke-miterlimit="10"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.51120001;stroke-miterlimit:10" /></g></g></g><g
id="vtail"><g id="vtail"><g
transform="translate(22.636675,7.8126685)" transform="translate(22.636675,7.8126685)"
id="vtail-frame"><path id="vtail-frame"><path

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 204 KiB

View File

@ -752,62 +752,62 @@ font:bold;</string>
<number>1</number> <number>1</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="label_14"> <widget class="QLabel" name="stab1_label">
<property name="text"> <property name="text">
<string>Stabilized 1</string> <string>Stabilized 1</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_21"> <widget class="QLabel" name="stab2_label">
<property name="text"> <property name="text">
<string>Stabilized 2</string> <string>Stabilized 2</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_22"> <widget class="QLabel" name="stab3_label">
<property name="text"> <property name="text">
<string>Stabilized 3</string> <string>Stabilized 3</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_114"> <widget class="QLabel" name="stab4_label">
<property name="text"> <property name="text">
<string>Stabilized 4</string> <string>Stabilized 4</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_121"> <widget class="QLabel" name="stab5_label">
<property name="text"> <property name="text">
<string>Stabilized 5</string> <string>Stabilized 5</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_122"> <widget class="QLabel" name="stab6_label">
<property name="text"> <property name="text">
<string>Stabilized 6</string> <string>Stabilized 6</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -30,41 +30,12 @@
#include "extensionsystem/pluginmanager.h" #include "extensionsystem/pluginmanager.h"
#include "uavobjectmanager.h" #include "uavobjectmanager.h"
#include "uavobject.h" #include "uavobject.h"
#include "utils/stringutils.h"
#include "flightbatterysettings.h" #include "flightbatterysettings.h"
#include <QQmlContext> #include <QQmlContext>
#include <QDebug> #include <QDebug>
/*
* 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), PfdQmlContext::PfdQmlContext(QObject *parent) : QObject(parent),
m_speedUnit("m/s"), m_speedUnit("m/s"),
m_speedFactor(1.0), m_speedFactor(1.0),
@ -350,7 +321,7 @@ void PfdQmlContext::apply(QQmlContext *context)
if (object) { if (object) {
// expose object with lower camel case name // expose object with lower camel case name
context->setContextProperty(toLowerCamelCase(objectName), object); context->setContextProperty(Utils::toLowerCamelCase(objectName), object);
} else { } else {
qWarning() << "PfdQmlContext::apply - failed to load object" << objectName; qWarning() << "PfdQmlContext::apply - failed to load object" << objectName;
} }

View File

@ -71,8 +71,7 @@ Item {
rotation: -attitudeState.yaw + course_degrees rotation: -attitudeState.yaw + course_degrees
transformOrigin: Item.Center transformOrigin: Item.Center
// FIXME : why test endEast twice? visible: ((pathDesired.endEast != 0.0) && (pathDesired.endNorth != 0.0))
visible: ((pathDesired.endEast != 0.0) && (pathDesired.endEast != 0.0))
} }
Item { Item {

View File

@ -3,9 +3,9 @@ import QtQuick 2.4
import UAVTalk.HwSettings 1.0 import UAVTalk.HwSettings 1.0
import UAVTalk.SystemAlarms 1.0 import UAVTalk.SystemAlarms 1.0
import UAVTalk.VelocityState 1.0 import UAVTalk.VelocityState 1.0
import UAVTalk.TakeOffLocation 1.0
import UAVTalk.PathDesired 1.0 import UAVTalk.PathDesired 1.0
import UAVTalk.WaypointActive 1.0 import UAVTalk.WaypointActive 1.0
import UAVTalk.TakeOffLocation 1.0 as TakeOffLocation
import UAVTalk.GPSPositionSensor 1.0 as GPSPositionSensor import UAVTalk.GPSPositionSensor 1.0 as GPSPositionSensor
import UAVTalk.GPSSatellites 1.0 import UAVTalk.GPSSatellites 1.0
import UAVTalk.FlightBatterySettings 1.0 import UAVTalk.FlightBatterySettings 1.0
@ -479,7 +479,7 @@ Item {
states: State { states: State {
name: "fading" 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; } PropertyChanges { target: home_bg; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; }
} }
@ -500,7 +500,7 @@ Item {
states: State { states: State {
name: "fading_heading" 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; } PropertyChanges { target: home_heading_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; }
} }
@ -531,7 +531,7 @@ Item {
states: State { states: State {
name: "fading_distance" 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; } PropertyChanges { target: home_distance_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; }
} }
@ -562,7 +562,7 @@ Item {
states: State { states: State {
name: "fading_distance" 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; } PropertyChanges { target: home_eta_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; }
} }

View File

@ -101,8 +101,7 @@ Item {
// Hack : check if telemetry is active. Works with real link and log replay // Hack : check if telemetry is active. Works with real link and log replay
function telemetry_check() { function telemetry_check() {
// FIXME : why rxRate + rxRate? telemetry_sum = opLinkStatus.rxRate + opLinkStatus.txRate
telemetry_sum = opLinkStatus.rxRate + opLinkStatus.rxRate
if (telemetry_sum != telemetry_sum_old || (opLinkStatus.linkState == LinkState.Connected)) { if (telemetry_sum != telemetry_sum_old || (opLinkStatus.linkState == LinkState.Connected)) {
telemetry_link = 1 telemetry_link = 1

View File

@ -8,6 +8,7 @@ DEB_REV := 0$(DEB_DIST)1
endif endif
DEB_NAME := $(ORG_SMALL_NAME) DEB_NAME := $(ORG_SMALL_NAME)
DEB_ORIG_SRC := $(PACKAGE_DIR)/$(DEB_NAME)_$(UPSTREAM_VER).orig.tar.gz 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_PACKAGE_DIR := $(PACKAGE_DIR)/$(DEB_NAME)-$(UPSTREAM_VER)
DEB_ARCH := $(shell dpkg --print-architecture) DEB_ARCH := $(shell dpkg --print-architecture)
DEB_PACKAGE_NAME := $(DEB_NAME)_$(UPSTREAM_VER)-$(DEB_REV)_$(DEB_ARCH) 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 package: debian
@$(ECHO) "Building Linux package, please wait..." @$(ECHO) "Building Linux package, please wait..."
$(V1) sed -i -e "$(PACKAGE_DEPS_SED)" debian/control $(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) dpkg-buildpackage -b -us -uc -nc
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(BUILD_DIR) $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(BUILD_DIR)
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(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) $(DEB_ORIG_SRC): $(DIST_TAR_GZ) | $(PACKAGE_DIR)
$(V1) cp $(DIST_TAR_GZ) $(DEB_ORIG_SRC) $(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_SRC) -C $(PACKAGE_DIR)
$(V1) tar -xf $(DEB_ORIG_FW) -C $(PACKAGE_DIR)/$(PACKAGE_NAME)
$(V1) mv debian $(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) $(V1) rm -rf $(DEB_PACKAGE_DIR) && mv $(PACKAGE_DIR)/$(PACKAGE_NAME) $(DEB_PACKAGE_DIR)

View File

@ -2,7 +2,7 @@ Source: <NAME>
Section: electronics Section: electronics
Priority: optional Priority: optional
Maintainer: The LibrePilot Project <<EMAIL>> Maintainer: The LibrePilot Project <<EMAIL>>
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 Standards-Version: 3.9.5
Homepage: <URL> Homepage: <URL>
Vcs-Git: <GIT_URL> Vcs-Git: <GIT_URL>

View File

@ -12,7 +12,7 @@ export DH_OPTIONS
dh $@ dh $@
override_dh_auto_build: 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: override_dh_auto_install:
dh_auto_install -- prefix=/usr dh_auto_install -- prefix=/usr