1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00

Merge branch 'next' into stac/use-malloc-failed-hook

This commit is contained in:
James Cotton 2011-08-27 00:12:45 -05:00
commit 274333a9bf
9 changed files with 919 additions and 651 deletions

View File

@ -923,6 +923,8 @@ void PIOS_Board_Init(void) {
TaskMonitorInitialize(); TaskMonitorInitialize();
/* Configure the main IO port */ /* Configure the main IO port */
uint8_t hwsettings_DSMxBind;
HwSettingsDSMxBindGet(&hwsettings_DSMxBind);
uint8_t hwsettings_cc_mainport; uint8_t hwsettings_cc_mainport;
HwSettingsCC_MainPortGet(&hwsettings_cc_mainport); HwSettingsCC_MainPortGet(&hwsettings_cc_mainport);
@ -991,7 +993,7 @@ void PIOS_Board_Init(void) {
} }
uint32_t pios_spektrum_id; uint32_t pios_spektrum_id;
if (PIOS_SPEKTRUM_Init(&pios_spektrum_id, &pios_spektrum_main_cfg, &pios_usart_com_driver, pios_usart_spektrum_id, false)) { if (PIOS_SPEKTRUM_Init(&pios_spektrum_id, &pios_spektrum_main_cfg, &pios_usart_com_driver, pios_usart_spektrum_id, 0)) {
PIOS_Assert(0); PIOS_Assert(0);
} }
} }
@ -1053,7 +1055,7 @@ void PIOS_Board_Init(void) {
} }
uint32_t pios_spektrum_id; uint32_t pios_spektrum_id;
if (PIOS_SPEKTRUM_Init(&pios_spektrum_id, &pios_spektrum_flexi_cfg, &pios_usart_com_driver, pios_usart_spektrum_id, false)) { if (PIOS_SPEKTRUM_Init(&pios_spektrum_id, &pios_spektrum_flexi_cfg, &pios_usart_com_driver, pios_usart_spektrum_id, hwsettings_DSMxBind)) {
PIOS_Assert(0); PIOS_Assert(0);
} }
} }

View File

@ -8,7 +8,6 @@
* *
* @file pios_spektrum.c * @file pios_spektrum.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Thorsten Klose (tk@midibox.org) (tk@midibox.org)
* @brief USART commands. Inits USARTs, controls USARTs & Interrupt handlers. (STM32 dependent) * @brief USART commands. Inits USARTs, controls USARTs & Interrupt handlers. (STM32 dependent)
* @see The GNU Public License (GPL) Version 3 * @see The GNU Public License (GPL) Version 3
* *
@ -59,7 +58,7 @@ uint8_t sync_of = 0;
uint16_t supv_timer=0; uint16_t supv_timer=0;
static void PIOS_SPEKTRUM_Supervisor(uint32_t spektrum_id); static void PIOS_SPEKTRUM_Supervisor(uint32_t spektrum_id);
static bool PIOS_SPEKTRUM_Bind(const struct pios_spektrum_cfg * cfg); static bool PIOS_SPEKTRUM_Bind(const struct pios_spektrum_cfg * cfg, uint8_t bind);
static int32_t PIOS_SPEKTRUM_Decode(uint8_t b); static int32_t PIOS_SPEKTRUM_Decode(uint8_t b);
static uint16_t PIOS_SPEKTRUM_RxInCallback(uint32_t context, uint8_t * buf, uint16_t buf_len, uint16_t * headroom, bool * need_yield) static uint16_t PIOS_SPEKTRUM_RxInCallback(uint32_t context, uint8_t * buf, uint16_t buf_len, uint16_t * headroom, bool * need_yield)
@ -85,11 +84,11 @@ static uint16_t PIOS_SPEKTRUM_RxInCallback(uint32_t context, uint8_t * buf, uint
/** /**
* Bind and Initialise Spektrum satellite receiver * Bind and Initialise Spektrum satellite receiver
*/ */
int32_t PIOS_SPEKTRUM_Init(uint32_t * spektrum_id, const struct pios_spektrum_cfg *cfg, const struct pios_com_driver * driver, uint32_t lower_id, bool bind) int32_t PIOS_SPEKTRUM_Init(uint32_t * spektrum_id, const struct pios_spektrum_cfg *cfg, const struct pios_com_driver * driver, uint32_t lower_id, uint8_t bind)
{ {
// TODO: need setting flag for bind on next powerup // TODO: need setting flag for bind on next powerup
if (bind) { if (bind) {
PIOS_SPEKTRUM_Bind(cfg); PIOS_SPEKTRUM_Bind(cfg,bind);
} }
(driver->bind_rx_cb)(lower_id, PIOS_SPEKTRUM_RxInCallback, 0); (driver->bind_rx_cb)(lower_id, PIOS_SPEKTRUM_RxInCallback, 0);
@ -121,9 +120,15 @@ static int32_t PIOS_SPEKTRUM_Get(uint32_t rcvr_id, uint8_t channel)
* \output true Successful bind * \output true Successful bind
* \output false Bind failed * \output false Bind failed
*/ */
static bool PIOS_SPEKTRUM_Bind(const struct pios_spektrum_cfg * cfg) static bool PIOS_SPEKTRUM_Bind(const struct pios_spektrum_cfg * cfg, uint8_t bind)
{ {
#define BIND_PULSES 5 GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = cfg->bind.init.GPIO_Pin;
GPIO_InitStructure.GPIO_Speed = cfg->bind.init.GPIO_Speed;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
/* just to limit bind pulses */
bind=(bind<=10)?bind:10;
GPIO_Init(cfg->bind.gpio, &cfg->bind.init); GPIO_Init(cfg->bind.gpio, &cfg->bind.init);
/* RX line, set high */ /* RX line, set high */
@ -132,7 +137,7 @@ static bool PIOS_SPEKTRUM_Bind(const struct pios_spektrum_cfg * cfg)
/* on CC works upto 140ms, I guess bind window is around 20-140ms after powerup */ /* on CC works upto 140ms, I guess bind window is around 20-140ms after powerup */
PIOS_DELAY_WaitmS(60); PIOS_DELAY_WaitmS(60);
for (int i = 0; i < BIND_PULSES ; i++) { for (int i = 0; i < bind ; i++) {
/* RX line, drive low for 120us */ /* RX line, drive low for 120us */
GPIO_ResetBits(cfg->bind.gpio, cfg->bind.init.GPIO_Pin); GPIO_ResetBits(cfg->bind.gpio, cfg->bind.init.GPIO_Pin);
PIOS_DELAY_WaituS(120); PIOS_DELAY_WaituS(120);
@ -141,6 +146,7 @@ static bool PIOS_SPEKTRUM_Bind(const struct pios_spektrum_cfg * cfg)
PIOS_DELAY_WaituS(120); PIOS_DELAY_WaituS(120);
} }
/* RX line, set input and wait for data, PIOS_SPEKTRUM_Init */ /* RX line, set input and wait for data, PIOS_SPEKTRUM_Init */
GPIO_Init(cfg->bind.gpio, &GPIO_InitStructure);
return true; return true;
} }
@ -172,9 +178,10 @@ static int32_t PIOS_SPEKTRUM_Decode(uint8_t b)
CaptureValue[7]=b; CaptureValue[7]=b;
} }
#endif #endif
/* Known sync bytes, 0x01, 0x02, 0x12 */ /* Known sync bytes, 0x01, 0x02, 0x12, 0xb2 */
/* 0xb2 DX8 3bind pulses only */
if (bytecount == 2) { if (bytecount == 2) {
if (b == 0x01) { if ((b == 0x01) || (b == 0xb2)) {
datalength=0; // 10bit datalength=0; // 10bit
//frames=1; //frames=1;
sync = 1; sync = 1;
@ -234,17 +241,17 @@ static int32_t PIOS_SPEKTRUM_Decode(uint8_t b)
*@brief clears the channel values *@brief clears the channel values
*/ */
static void PIOS_SPEKTRUM_Supervisor(uint32_t spektrum_id) { static void PIOS_SPEKTRUM_Supervisor(uint32_t spektrum_id) {
/* 125hz */ /* 625hz */
supv_timer++; supv_timer++;
if(supv_timer > 5) { if(supv_timer > 4) {
/* sync between frames */ /* sync between frames */
sync = 0; sync = 0;
bytecount = 0; bytecount = 0;
prev_byte = 0xFF; prev_byte = 0xFF;
frame_error = 0; frame_error = 0;
sync_of++; sync_of++;
/* watchdog activated after 100ms silence */ /* watchdog activated after 200ms silence */
if (sync_of > 12) { if (sync_of > 30) {
/* signal lost */ /* signal lost */
sync_of = 0; sync_of = 0;
for (int i = 0; i < PIOS_SPEKTRUM_NUM_INPUTS; i++) { for (int i = 0; i < PIOS_SPEKTRUM_NUM_INPUTS; i++) {

View File

@ -42,7 +42,7 @@ struct pios_spektrum_cfg {
extern const struct pios_rcvr_driver pios_spektrum_rcvr_driver; extern const struct pios_rcvr_driver pios_spektrum_rcvr_driver;
extern int32_t PIOS_SPEKTRUM_Init(uint32_t * spektrum_id, const struct pios_spektrum_cfg *cfg, const struct pios_com_driver * driver, uint32_t lower_id, bool bind); extern int32_t PIOS_SPEKTRUM_Init(uint32_t * spektrum_id, const struct pios_spektrum_cfg *cfg, const struct pios_com_driver * driver, uint32_t lower_id, uint8_t bind);
#endif /* PIOS_PWM_PRIV_H */ #endif /* PIOS_PWM_PRIV_H */

View File

@ -0,0 +1,159 @@
/**
******************************************************************************
*
* @file cachedsvgitem.h
* @author Dmytro Poplavskiy Copyright (C) 2011.
* @{
* @brief OpenGL texture cached SVG item
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "cachedsvgitem.h"
#include <QGLContext>
#include <QDebug>
#ifndef GL_CLAMP_TO_EDGE
#define GL_CLAMP_TO_EDGE 0x812F
#endif
CachedSvgItem::CachedSvgItem(QGraphicsItem * parent) :
QGraphicsSvgItem(parent),
m_context(0),
m_texture(0),
m_scale(1.0)
{
setCacheMode(NoCache);
}
CachedSvgItem::CachedSvgItem(const QString & fileName, QGraphicsItem * parent):
QGraphicsSvgItem(fileName, parent),
m_context(0),
m_texture(0),
m_scale(1.0)
{
setCacheMode(NoCache);
}
CachedSvgItem::~CachedSvgItem()
{
if (m_context && m_texture) {
m_context->makeCurrent();
glDeleteTextures(1, &m_texture);
}
}
void CachedSvgItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
if (painter->paintEngine()->type() != QPaintEngine::OpenGL &&
painter->paintEngine()->type() != QPaintEngine::OpenGL2) {
//Fallback to direct painting
QGraphicsSvgItem::paint(painter, option, widget);
return;
}
QRectF br = boundingRect();
QTransform transform = painter->worldTransform();
qreal sceneScale = transform.map(QLineF(0,0,1,0)).length();
bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST);
bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST);
painter->beginNativePainting();
if (stencilTestEnabled)
glEnable(GL_STENCIL_TEST);
if (scissorTestEnabled)
glEnable(GL_SCISSOR_TEST);
bool dirty = false;
if (!m_texture) {
glGenTextures(1, &m_texture);
m_context = const_cast<QGLContext*>(QGLContext::currentContext());
dirty = true;
}
if (!qFuzzyCompare(sceneScale, m_scale)) {
m_scale = sceneScale;
dirty = true;
}
int textureWidth = (int(br.width()*m_scale) + 3) & ~3;
int textureHeight = (int(br.height()*m_scale) + 3) & ~3;
if (dirty) {
//qDebug() << "re-render image";
QImage img(textureWidth, textureHeight, QImage::Format_ARGB32);
{
img.fill(Qt::transparent);
QPainter p;
p.begin(&img);
p.setRenderHints(painter->renderHints());
p.translate(br.topLeft());
p.scale(m_scale, m_scale);
QGraphicsSvgItem::paint(&p, option, 0);
p.end();
img = img.rgbSwapped();
}
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, m_texture);
glTexImage2D(
GL_TEXTURE_2D,
0,
GL_RGBA,
textureWidth,
textureHeight,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
img.bits());
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glDisable(GL_TEXTURE_2D);
dirty = false;
}
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, m_texture);
//texture may be slightly large than svn image, ensure only used area is rendered
qreal tw = br.width()*m_scale/textureWidth;
qreal th = br.height()*m_scale/textureHeight;
glBegin(GL_QUADS);
glTexCoord2d(0, 0 ); glVertex3d(br.left(), br.top(), -1);
glTexCoord2d(tw, 0 ); glVertex3d(br.right(), br.top(), -1);
glTexCoord2d(tw, th); glVertex3d(br.right(), br.bottom(), -1);
glTexCoord2d(0, th); glVertex3d(br.left(), br.bottom(), -1);
glEnd();
glDisable(GL_TEXTURE_2D);
painter->endNativePainting();
}

View File

@ -0,0 +1,54 @@
/**
******************************************************************************
*
* @file cachedsvgitem.h
* @author Dmytro Poplavskiy Copyright (C) 2011.
* @{
* @brief OpenGL texture cached SVG item
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CACHEDSVGITEM_H
#define CACHEDSVGITEM_H
#include <QGraphicsSvgItem>
#include <QGLContext>
#include "utils_global.h"
class QGLContext;
//Cache Svg item as GL Texture.
//Texture is regenerated each time item is scaled
//but it's reused during rotation, unlike DeviceCoordinateCache mode
class QTCREATOR_UTILS_EXPORT CachedSvgItem: public QGraphicsSvgItem
{
Q_OBJECT
public:
CachedSvgItem(QGraphicsItem * parent = 0);
CachedSvgItem(const QString & fileName, QGraphicsItem * parent = 0);
~CachedSvgItem();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private:
QGLContext *m_context;
GLuint m_texture;
qreal m_scale;
};
#endif

View File

@ -3,7 +3,9 @@ TARGET = Utils
QT += gui \ QT += gui \
network \ network \
xml xml \
svg \
opengl
DEFINES += QTCREATOR_UTILS_LIB DEFINES += QTCREATOR_UTILS_LIB
@ -48,7 +50,8 @@ SOURCES += reloadpromptutils.cpp \
homelocationutil.cpp \ homelocationutil.cpp \
mytabbedstackwidget.cpp \ mytabbedstackwidget.cpp \
mytabwidget.cpp \ mytabwidget.cpp \
mylistwidget.cpp mylistwidget.cpp \
cachedsvgitem.cpp
SOURCES += xmlconfig.cpp SOURCES += xmlconfig.cpp
win32 { win32 {
@ -102,7 +105,8 @@ HEADERS += utils_global.h \
homelocationutil.h \ homelocationutil.h \
mytabbedstackwidget.h \ mytabbedstackwidget.h \
mytabwidget.h \ mytabwidget.h \
mylistwidget.h mylistwidget.h \
cachedsvgitem.h
HEADERS += xmlconfig.h HEADERS += xmlconfig.h
FORMS += filewizardpage.ui \ FORMS += filewizardpage.ui \

View File

@ -6,649 +6,689 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>639</width> <width>683</width>
<height>611</height> <height>685</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>1</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="frameShape">
<size> <enum>QFrame::NoFrame</enum>
<width>0</width>
<height>150</height>
</size>
</property> </property>
<property name="title"> <property name="widgetResizable">
<string>Rate Stabilization Coefficients (Inner Loop)</string> <bool>true</bool>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <widget class="QWidget" name="scrollAreaWidgetContents">
<item row="0" column="2"> <property name="geometry">
<widget class="QLabel" name="label_12"> <rect>
<property name="text"> <x>0</x>
<string>Kp</string> <y>0</y>
</property> <width>665</width>
<property name="alignment"> <height>627</height>
<set>Qt::AlignCenter</set> </rect>
</property> </property>
</widget> <property name="sizePolicy">
</item> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<item row="0" column="3"> <horstretch>0</horstretch>
<widget class="QLabel" name="label_13"> <verstretch>0</verstretch>
<property name="text"> </sizepolicy>
<string>Ki</string> </property>
</property> <layout class="QVBoxLayout" name="verticalLayout">
<property name="alignment"> <property name="spacing">
<set>Qt::AlignCenter</set> <number>0</number>
</property> </property>
</widget> <property name="margin">
</item> <number>0</number>
<item row="0" column="4"> </property>
<widget class="QLabel" name="label_14"> <item>
<property name="text"> <widget class="QGroupBox" name="groupBox">
<string>ILimit</string> <property name="sizePolicy">
</property> <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<property name="alignment"> <horstretch>0</horstretch>
<set>Qt::AlignCenter</set> <verstretch>0</verstretch>
</property> </sizepolicy>
</widget> </property>
</item> <property name="minimumSize">
<item row="1" column="1"> <size>
<widget class="QLabel" name="label_10"> <width>0</width>
<property name="text"> <height>150</height>
<string>Roll</string> </size>
</property> </property>
</widget> <property name="title">
</item> <string>Rate Stabilization Coefficients (Inner Loop)</string>
<item row="1" column="2"> </property>
<widget class="QDoubleSpinBox" name="rateRollKp"> <layout class="QGridLayout" name="gridLayout_3">
<property name="toolTip"> <item row="0" column="2">
<string>Slowly raise Kp until you start seeing clear oscillations when you fly. <widget class="QLabel" name="label_12">
<property name="text">
<string>Kp</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Ki</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_14">
<property name="text">
<string>ILimit</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Roll</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="rateRollKp">
<property name="toolTip">
<string>Slowly raise Kp until you start seeing clear oscillations when you fly.
Then lower the value by 20% or so.</string> Then lower the value by 20% or so.</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.000100000000000</double> <double>0.000100000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="3"> <item row="1" column="3">
<widget class="QDoubleSpinBox" name="rateRollKi"> <widget class="QDoubleSpinBox" name="rateRollKi">
<property name="toolTip"> <property name="toolTip">
<string>I factor for rate stabilization is usually very low or even zero.</string> <string>I factor for rate stabilization is usually very low or even zero.</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.000100000000000</double> <double>0.000100000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="4"> <item row="1" column="4">
<widget class="QDoubleSpinBox" name="rateRollILimit"> <widget class="QDoubleSpinBox" name="rateRollILimit">
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.000100000000000</double> <double>0.000100000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QCheckBox" name="linkRateRP"> <widget class="QCheckBox" name="linkRateRP">
<property name="toolTip"> <property name="toolTip">
<string>If checked, the Roll and Pitch factors will be identical. <string>If checked, the Roll and Pitch factors will be identical.
When you change one, the other is updated.</string> When you change one, the other is updated.</string>
</property> </property>
<property name="text"> <property name="text">
<string>Link</string> <string>Link</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="label_11">
<property name="text"> <property name="text">
<string>Pitch</string> <string>Pitch</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="2" column="2">
<widget class="QDoubleSpinBox" name="ratePitchKp"> <widget class="QDoubleSpinBox" name="ratePitchKp">
<property name="toolTip"> <property name="toolTip">
<string>Slowly raise Kp until you start seeing clear oscillations when you fly. <string>Slowly raise Kp until you start seeing clear oscillations when you fly.
Then lower the value by 20% or so.</string> Then lower the value by 20% or so.</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.000100000000000</double> <double>0.000100000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="3"> <item row="2" column="3">
<widget class="QDoubleSpinBox" name="ratePitchKi"> <widget class="QDoubleSpinBox" name="ratePitchKi">
<property name="toolTip"> <property name="toolTip">
<string>I factor for rate stabilization is usually very low or even zero.</string> <string>I factor for rate stabilization is usually very low or even zero.</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.000100000000000</double> <double>0.000100000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="4"> <item row="2" column="4">
<widget class="QDoubleSpinBox" name="ratePitchILimit"> <widget class="QDoubleSpinBox" name="ratePitchILimit">
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.000100000000000</double> <double>0.000100000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLabel" name="label_15"> <widget class="QLabel" name="label_15">
<property name="text"> <property name="text">
<string>Yaw</string> <string>Yaw</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="3" column="2">
<widget class="QDoubleSpinBox" name="rateYawKp"> <widget class="QDoubleSpinBox" name="rateYawKp">
<property name="toolTip"> <property name="toolTip">
<string>Slowly raise Kp until you start seeing clear oscillations when you fly. <string>Slowly raise Kp until you start seeing clear oscillations when you fly.
Then lower the value by 20% or so. Then lower the value by 20% or so.
You can usually go for higher values for Yaw factors.</string> You can usually go for higher values for Yaw factors.</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.000100000000000</double> <double>0.000100000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="3"> <item row="3" column="3">
<widget class="QDoubleSpinBox" name="rateYawKi"> <widget class="QDoubleSpinBox" name="rateYawKi">
<property name="toolTip"> <property name="toolTip">
<string>As a rule of thumb, you can set YawRate Ki at roughly the same <string>As a rule of thumb, you can set YawRate Ki at roughly the same
value as YawRate Kp.</string> value as YawRate Kp.</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.000100000000000</double> <double>0.000100000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="4"> <item row="3" column="4">
<widget class="QDoubleSpinBox" name="rateYawILimit"> <widget class="QDoubleSpinBox" name="rateYawILimit">
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.000100000000000</double> <double>0.000100000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer_3"> <spacer name="verticalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType"> <property name="sizeType">
<enum>QSizePolicy::Fixed</enum> <enum>QSizePolicy::Fixed</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>5</height> <height>13</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>150</height> <height>150</height>
</size> </size>
</property> </property>
<property name="title"> <property name="title">
<string>Attitude Stabization Coefficients (Outer Loop)</string> <string>Attitude Stabization Coefficients (Outer Loop)</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="2"> <item row="3" column="2">
<widget class="QDoubleSpinBox" name="rollKp"> <widget class="QDoubleSpinBox" name="rollKp">
<property name="toolTip"> <property name="toolTip">
<string>Once Rate stabilization is done, you should increase the Kp factor until the airframe oscillates again, and go back down 20% or so. <string>Once Rate stabilization is done, you should increase the Kp factor until the airframe oscillates again, and go back down 20% or so.
</string> </string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.100000000000000</double> <double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="3"> <item row="3" column="3">
<widget class="QDoubleSpinBox" name="rollKi"> <widget class="QDoubleSpinBox" name="rollKi">
<property name="toolTip"> <property name="toolTip">
<string>Ki can usually be almost identical to Kp.</string> <string>Ki can usually be almost identical to Kp.</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.100000000000000</double> <double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="4"> <item row="3" column="4">
<widget class="QDoubleSpinBox" name="rollILimit"> <widget class="QDoubleSpinBox" name="rollILimit">
<property name="toolTip"> <property name="toolTip">
<string>ILimit can be equal to three to four times Ki, but you can adjust <string>ILimit can be equal to three to four times Ki, but you can adjust
depending on whether your airframe is well balanced, and your depending on whether your airframe is well balanced, and your
flying style.</string> flying style.</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.100000000000000</double> <double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="2" column="2">
<widget class="QLabel" name="label_19"> <widget class="QLabel" name="label_19">
<property name="text"> <property name="text">
<string>Kp</string> <string>Kp</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="3"> <item row="2" column="3">
<widget class="QLabel" name="label_20"> <widget class="QLabel" name="label_20">
<property name="text"> <property name="text">
<string>Ki</string> <string>Ki</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="4"> <item row="2" column="4">
<widget class="QLabel" name="label_21"> <widget class="QLabel" name="label_21">
<property name="text"> <property name="text">
<string>ILimit</string> <string>ILimit</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="4"> <item row="7" column="4">
<widget class="QDoubleSpinBox" name="yawILimit"> <widget class="QDoubleSpinBox" name="yawILimit">
<property name="toolTip"> <property name="toolTip">
<string>ILimit can be equal to three to four times Ki, but you can adjust <string>ILimit can be equal to three to four times Ki, but you can adjust
depending on whether your airframe is well balanced, and your depending on whether your airframe is well balanced, and your
flying style.</string> flying style.</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.100000000000000</double> <double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="3"> <item row="7" column="3">
<widget class="QDoubleSpinBox" name="yawKi"> <widget class="QDoubleSpinBox" name="yawKi">
<property name="toolTip"> <property name="toolTip">
<string>Ki can usually be almost identical to Kp.</string> <string>Ki can usually be almost identical to Kp.</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.100000000000000</double> <double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="2"> <item row="7" column="2">
<widget class="QDoubleSpinBox" name="yawKp"> <widget class="QDoubleSpinBox" name="yawKp">
<property name="toolTip"> <property name="toolTip">
<string>Once Rate stabilization is done, you should increase the Kp factor until the airframe oscillates again, and go back down 20% or so. <string>Once Rate stabilization is done, you should increase the Kp factor until the airframe oscillates again, and go back down 20% or so.
</string> </string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.100000000000000</double> <double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="2"> <item row="6" column="2">
<widget class="QDoubleSpinBox" name="pitchKp"> <widget class="QDoubleSpinBox" name="pitchKp">
<property name="toolTip"> <property name="toolTip">
<string>Once Rate stabilization is done, you should increase the Kp factor until the airframe oscillates again, and go back down 20% or so. <string>Once Rate stabilization is done, you should increase the Kp factor until the airframe oscillates again, and go back down 20% or so.
</string> </string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.100000000000000</double> <double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="7" column="1">
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="label_18">
<property name="text"> <property name="text">
<string>Yaw</string> <string>Yaw</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="6" column="1">
<widget class="QLabel" name="label_17"> <widget class="QLabel" name="label_17">
<property name="text"> <property name="text">
<string>Pitch</string> <string>Pitch</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLabel" name="label_16"> <widget class="QLabel" name="label_16">
<property name="text"> <property name="text">
<string>Roll</string> <string>Roll</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="3"> <item row="6" column="3">
<widget class="QDoubleSpinBox" name="pitchKi"> <widget class="QDoubleSpinBox" name="pitchKi">
<property name="toolTip"> <property name="toolTip">
<string>Ki can usually be almost identical to Kp.</string> <string>Ki can usually be almost identical to Kp.</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.100000000000000</double> <double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="4"> <item row="6" column="4">
<widget class="QDoubleSpinBox" name="pitchILimit"> <widget class="QDoubleSpinBox" name="pitchILimit">
<property name="toolTip"> <property name="toolTip">
<string>ILimit can be equal to three to four times Ki, but you can adjust <string>ILimit can be equal to three to four times Ki, but you can adjust
depending on whether your airframe is well balanced, and your depending on whether your airframe is well balanced, and your
flying style.</string> flying style.</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.100000000000000</double> <double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="6" column="0">
<widget class="QCheckBox" name="linkAttitudeRP"> <widget class="QCheckBox" name="linkAttitudeRP">
<property name="toolTip"> <property name="toolTip">
<string>If checked, the Roll and Pitch factors will be identical. <string>If checked, the Roll and Pitch factors will be identical.
When you change one, the other is updated.</string> When you change one, the other is updated.</string>
</property> </property>
<property name="text"> <property name="text">
<string>Link</string> <string>Link</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Stick range and limits</string>
</property>
<layout class="QGridLayout" name="gridLayout" rowminimumheight="5,5,5,5">
<property name="sizeConstraint">
<enum>QLayout::SetMinAndMaxSize</enum>
</property>
<item row="0" column="1">
<widget class="QLabel" name="label">
<property name="text">
<string>Roll</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Pitch</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Yaw</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="rollMax">
<property name="maximum">
<number>180</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="pitchMax">
<property name="maximum">
<number>180</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="yawMax">
<property name="maximum">
<number>180</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Full stick angle (deg)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Full stick rate (deg/s)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="manualRoll">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="manualPitch">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QSpinBox" name="manualYaw">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_24">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string notr="true"/>
</property>
<property name="text">
<string>Maximum rate in attitude mode (deg/s)</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="maximumRoll">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSpinBox" name="maximumPitch">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QSpinBox" name="maximumYaw">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="lowThrottleZeroIntegral">
<property name="text">
<string>Zero the integral when throttle is low</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Stick range and limits</string>
</property>
<layout class="QGridLayout" name="gridLayout" rowminimumheight="5,5,5,5">
<property name="sizeConstraint">
<enum>QLayout::SetMinAndMaxSize</enum>
</property>
<item row="0" column="1">
<widget class="QLabel" name="label">
<property name="text">
<string>Roll</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Pitch</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Yaw</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="rollMax">
<property name="maximum">
<number>180</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="pitchMax">
<property name="maximum">
<number>180</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="yawMax">
<property name="maximum">
<number>180</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Full stick angle (deg)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Full stick rate (deg/s)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="manualRoll">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="manualPitch">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QSpinBox" name="manualYaw">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_24">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string notr="true"/>
</property>
<property name="text">
<string>Maximum rate in attitude mode (deg/s)</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="maximumRoll">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSpinBox" name="maximumPitch">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QSpinBox" name="maximumYaw">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="lowThrottleZeroIntegral">
<property name="text">
<string>Zero the integral when throttle is low</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>

View File

@ -27,6 +27,7 @@
#include "pfdgadgetwidget.h" #include "pfdgadgetwidget.h"
#include <utils/stylehelper.h> #include <utils/stylehelper.h>
#include <utils/cachedsvgitem.h>
#include <iostream> #include <iostream>
#include <QDebug> #include <QDebug>
#include <QPainter> #include <QPainter>
@ -383,7 +384,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
- Battery stats: battery-txt - Battery stats: battery-txt
*/ */
l_scene->clear(); // Deletes all items contained in the scene as well. l_scene->clear(); // Deletes all items contained in the scene as well.
m_background = new QGraphicsSvgItem(); m_background = new CachedSvgItem();
// All other items will be clipped to the shape of the background // All other items will be clipped to the shape of the background
m_background->setFlags(QGraphicsItem::ItemClipsChildrenToShape| m_background->setFlags(QGraphicsItem::ItemClipsChildrenToShape|
QGraphicsItem::ItemClipsToShape); QGraphicsItem::ItemClipsToShape);
@ -391,28 +392,28 @@ void PFDGadgetWidget::setDialFile(QString dfn)
m_background->setElementId("background"); m_background->setElementId("background");
l_scene->addItem(m_background); l_scene->addItem(m_background);
m_world = new QGraphicsSvgItem(); m_world = new CachedSvgItem();
m_world->setParentItem(m_background); m_world->setParentItem(m_background);
m_world->setSharedRenderer(m_renderer); m_world->setSharedRenderer(m_renderer);
m_world->setElementId("world"); m_world->setElementId("world");
l_scene->addItem(m_world); l_scene->addItem(m_world);
// red Roll scale: rollscale // red Roll scale: rollscale
m_rollscale = new QGraphicsSvgItem(); m_rollscale = new CachedSvgItem();
m_rollscale->setSharedRenderer(m_renderer); m_rollscale->setSharedRenderer(m_renderer);
m_rollscale->setElementId("rollscale"); m_rollscale->setElementId("rollscale");
l_scene->addItem(m_rollscale); l_scene->addItem(m_rollscale);
// Home point: // Home point:
m_homewaypoint = new QGraphicsSvgItem(); m_homewaypoint = new CachedSvgItem();
// Next point: // Next point:
m_nextwaypoint = new QGraphicsSvgItem(); m_nextwaypoint = new CachedSvgItem();
// Home point bearing: // Home point bearing:
m_homepointbearing = new QGraphicsSvgItem(); m_homepointbearing = new CachedSvgItem();
// Next point bearing: // Next point bearing:
m_nextpointbearing = new QGraphicsSvgItem(); m_nextpointbearing = new CachedSvgItem();
QGraphicsSvgItem *m_foreground = new QGraphicsSvgItem(); QGraphicsSvgItem *m_foreground = new CachedSvgItem();
m_foreground->setParentItem(m_background); m_foreground->setParentItem(m_background);
m_foreground->setSharedRenderer(m_renderer); m_foreground->setSharedRenderer(m_renderer);
m_foreground->setElementId("foreground"); m_foreground->setElementId("foreground");
@ -429,7 +430,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
// into a QGraphicsSvgItem which we will display at the same // into a QGraphicsSvgItem which we will display at the same
// place: we do this so that the heading scale can be clipped to // place: we do this so that the heading scale can be clipped to
// the compass dial region. // the compass dial region.
m_compass = new QGraphicsSvgItem(); m_compass = new CachedSvgItem();
m_compass->setSharedRenderer(m_renderer); m_compass->setSharedRenderer(m_renderer);
m_compass->setElementId("compass"); m_compass->setElementId("compass");
m_compass->setFlags(QGraphicsItem::ItemClipsChildrenToShape| m_compass->setFlags(QGraphicsItem::ItemClipsChildrenToShape|
@ -440,7 +441,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
m_compass->setTransform(matrix,false); m_compass->setTransform(matrix,false);
// Now place the compass scale inside: // Now place the compass scale inside:
m_compassband = new QGraphicsSvgItem(); m_compassband = new CachedSvgItem();
m_compassband->setSharedRenderer(m_renderer); m_compassband->setSharedRenderer(m_renderer);
m_compassband->setElementId("compass-band"); m_compassband->setElementId("compass-band");
m_compassband->setParentItem(m_compass); m_compassband->setParentItem(m_compass);
@ -462,7 +463,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
compassMatrix = m_renderer->matrixForElement("speed-bg"); compassMatrix = m_renderer->matrixForElement("speed-bg");
startX = compassMatrix.mapRect(m_renderer->boundsOnElement("speed-bg")).x(); startX = compassMatrix.mapRect(m_renderer->boundsOnElement("speed-bg")).x();
startY = compassMatrix.mapRect(m_renderer->boundsOnElement("speed-bg")).y(); startY = compassMatrix.mapRect(m_renderer->boundsOnElement("speed-bg")).y();
QGraphicsSvgItem *verticalbg = new QGraphicsSvgItem(); QGraphicsSvgItem *verticalbg = new CachedSvgItem();
verticalbg->setSharedRenderer(m_renderer); verticalbg->setSharedRenderer(m_renderer);
verticalbg->setElementId("speed-bg"); verticalbg->setElementId("speed-bg");
verticalbg->setFlags(QGraphicsItem::ItemClipsChildrenToShape| verticalbg->setFlags(QGraphicsItem::ItemClipsChildrenToShape|
@ -477,7 +478,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
m_speedscale = new QGraphicsItemGroup(); m_speedscale = new QGraphicsItemGroup();
m_speedscale->setParentItem(verticalbg); m_speedscale->setParentItem(verticalbg);
QGraphicsSvgItem *speedscalelines = new QGraphicsSvgItem(); QGraphicsSvgItem *speedscalelines = new CachedSvgItem();
speedscalelines->setSharedRenderer(m_renderer); speedscalelines->setSharedRenderer(m_renderer);
speedscalelines->setElementId("speed-scale"); speedscalelines->setElementId("speed-scale");
speedScaleHeight = m_renderer->matrixForElement("speed-scale").mapRect( speedScaleHeight = m_renderer->matrixForElement("speed-scale").mapRect(
@ -523,7 +524,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
startX = compassMatrix.mapRect(m_renderer->boundsOnElement("speed-window")).x(); startX = compassMatrix.mapRect(m_renderer->boundsOnElement("speed-window")).x();
startY = compassMatrix.mapRect(m_renderer->boundsOnElement("speed-window")).y(); startY = compassMatrix.mapRect(m_renderer->boundsOnElement("speed-window")).y();
qreal speedWindowHeight = compassMatrix.mapRect(m_renderer->boundsOnElement("speed-window")).height(); qreal speedWindowHeight = compassMatrix.mapRect(m_renderer->boundsOnElement("speed-window")).height();
QGraphicsSvgItem *speedwindow = new QGraphicsSvgItem(); QGraphicsSvgItem *speedwindow = new CachedSvgItem();
speedwindow->setSharedRenderer(m_renderer); speedwindow->setSharedRenderer(m_renderer);
speedwindow->setElementId("speed-window"); speedwindow->setElementId("speed-window");
speedwindow->setFlags(QGraphicsItem::ItemClipsChildrenToShape| speedwindow->setFlags(QGraphicsItem::ItemClipsChildrenToShape|
@ -548,7 +549,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
compassMatrix = m_renderer->matrixForElement("altitude-bg"); compassMatrix = m_renderer->matrixForElement("altitude-bg");
startX = compassMatrix.mapRect(m_renderer->boundsOnElement("altitude-bg")).x(); startX = compassMatrix.mapRect(m_renderer->boundsOnElement("altitude-bg")).x();
startY = compassMatrix.mapRect(m_renderer->boundsOnElement("altitude-bg")).y(); startY = compassMatrix.mapRect(m_renderer->boundsOnElement("altitude-bg")).y();
verticalbg = new QGraphicsSvgItem(); verticalbg = new CachedSvgItem();
verticalbg->setSharedRenderer(m_renderer); verticalbg->setSharedRenderer(m_renderer);
verticalbg->setElementId("altitude-bg"); verticalbg->setElementId("altitude-bg");
verticalbg->setFlags(QGraphicsItem::ItemClipsChildrenToShape| verticalbg->setFlags(QGraphicsItem::ItemClipsChildrenToShape|
@ -563,7 +564,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
m_altitudescale = new QGraphicsItemGroup(); m_altitudescale = new QGraphicsItemGroup();
m_altitudescale->setParentItem(verticalbg); m_altitudescale->setParentItem(verticalbg);
QGraphicsSvgItem *altitudescalelines = new QGraphicsSvgItem(); QGraphicsSvgItem *altitudescalelines = new CachedSvgItem();
altitudescalelines->setSharedRenderer(m_renderer); altitudescalelines->setSharedRenderer(m_renderer);
altitudescalelines->setElementId("altitude-scale"); altitudescalelines->setElementId("altitude-scale");
altitudeScaleHeight = m_renderer->matrixForElement("altitude-scale").mapRect( altitudeScaleHeight = m_renderer->matrixForElement("altitude-scale").mapRect(
@ -604,7 +605,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
startX = compassMatrix.mapRect(m_renderer->boundsOnElement("altitude-window")).x(); startX = compassMatrix.mapRect(m_renderer->boundsOnElement("altitude-window")).x();
startY = compassMatrix.mapRect(m_renderer->boundsOnElement("altitude-window")).y(); startY = compassMatrix.mapRect(m_renderer->boundsOnElement("altitude-window")).y();
qreal altitudeWindowHeight = compassMatrix.mapRect(m_renderer->boundsOnElement("altitude-window")).height(); qreal altitudeWindowHeight = compassMatrix.mapRect(m_renderer->boundsOnElement("altitude-window")).height();
QGraphicsSvgItem *altitudewindow = new QGraphicsSvgItem(); QGraphicsSvgItem *altitudewindow = new CachedSvgItem();
altitudewindow->setSharedRenderer(m_renderer); altitudewindow->setSharedRenderer(m_renderer);
altitudewindow->setElementId("altitude-window"); altitudewindow->setElementId("altitude-window");
altitudewindow->setFlags(QGraphicsItem::ItemClipsChildrenToShape| altitudewindow->setFlags(QGraphicsItem::ItemClipsChildrenToShape|
@ -633,7 +634,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
compassMatrix = m_renderer->matrixForElement("gcstelemetry-Disconnected"); compassMatrix = m_renderer->matrixForElement("gcstelemetry-Disconnected");
startX = compassMatrix.mapRect(m_renderer->boundsOnElement("gcstelemetry-Disconnected")).x(); startX = compassMatrix.mapRect(m_renderer->boundsOnElement("gcstelemetry-Disconnected")).x();
startY = compassMatrix.mapRect(m_renderer->boundsOnElement("gcstelemetry-Disconnected")).y(); startY = compassMatrix.mapRect(m_renderer->boundsOnElement("gcstelemetry-Disconnected")).y();
gcsTelemetryArrow = new QGraphicsSvgItem(); gcsTelemetryArrow = new CachedSvgItem();
gcsTelemetryArrow->setSharedRenderer(m_renderer); gcsTelemetryArrow->setSharedRenderer(m_renderer);
gcsTelemetryArrow->setElementId("gcstelemetry-Disconnected"); gcsTelemetryArrow->setElementId("gcstelemetry-Disconnected");
l_scene->addItem(gcsTelemetryArrow); l_scene->addItem(gcsTelemetryArrow);
@ -669,7 +670,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
compassMatrix = m_renderer->matrixForElement("gcstelemetry-Disconnected"); compassMatrix = m_renderer->matrixForElement("gcstelemetry-Disconnected");
startX = compassMatrix.mapRect(m_renderer->boundsOnElement("gcstelemetry-Disconnected")).x(); startX = compassMatrix.mapRect(m_renderer->boundsOnElement("gcstelemetry-Disconnected")).x();
startY = compassMatrix.mapRect(m_renderer->boundsOnElement("gcstelemetry-Disconnected")).y(); startY = compassMatrix.mapRect(m_renderer->boundsOnElement("gcstelemetry-Disconnected")).y();
gcsTelemetryArrow = new QGraphicsSvgItem(); gcsTelemetryArrow = new CachedSvgItem();
gcsTelemetryArrow->setSharedRenderer(m_renderer); gcsTelemetryArrow->setSharedRenderer(m_renderer);
gcsTelemetryArrow->setElementId("gcstelemetry-Disconnected"); gcsTelemetryArrow->setElementId("gcstelemetry-Disconnected");
l_scene->addItem(gcsTelemetryArrow); l_scene->addItem(gcsTelemetryArrow);
@ -702,7 +703,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
compassMatrix = m_renderer->matrixForElement("gcstelemetry-Disconnected"); compassMatrix = m_renderer->matrixForElement("gcstelemetry-Disconnected");
startX = compassMatrix.mapRect(m_renderer->boundsOnElement("gcstelemetry-Disconnected")).x(); startX = compassMatrix.mapRect(m_renderer->boundsOnElement("gcstelemetry-Disconnected")).x();
startY = compassMatrix.mapRect(m_renderer->boundsOnElement("gcstelemetry-Disconnected")).y(); startY = compassMatrix.mapRect(m_renderer->boundsOnElement("gcstelemetry-Disconnected")).y();
gcsTelemetryArrow = new QGraphicsSvgItem(); gcsTelemetryArrow = new CachedSvgItem();
gcsTelemetryArrow->setSharedRenderer(m_renderer); gcsTelemetryArrow->setSharedRenderer(m_renderer);
gcsTelemetryArrow->setElementId("gcstelemetry-Disconnected"); gcsTelemetryArrow->setElementId("gcstelemetry-Disconnected");
l_scene->addItem(gcsTelemetryArrow); l_scene->addItem(gcsTelemetryArrow);
@ -771,7 +772,7 @@ void PFDGadgetWidget::setDialFile(QString dfn)
{ qDebug()<<"Error on PFD artwork file."; { qDebug()<<"Error on PFD artwork file.";
m_renderer->load(QString(":/pfd/images/pfd-default.svg")); m_renderer->load(QString(":/pfd/images/pfd-default.svg"));
l_scene->clear(); // This also deletes all items contained in the scene. l_scene->clear(); // This also deletes all items contained in the scene.
m_background = new QGraphicsSvgItem(); m_background = new CachedSvgItem();
m_background->setSharedRenderer(m_renderer); m_background->setSharedRenderer(m_renderer);
l_scene->addItem(m_background); l_scene->addItem(m_background);
pfdError = true; pfdError = true;

View File

@ -4,6 +4,7 @@
<field name="CC_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,Spektrum,ComAux,I2C" defaultvalue="Disabled"/> <field name="CC_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,Spektrum,ComAux,I2C" defaultvalue="Disabled"/>
<field name="CC_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,S.Bus,GPS,Spektrum,ComAux" defaultvalue="Telemetry"/> <field name="CC_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,S.Bus,GPS,Spektrum,ComAux" defaultvalue="Telemetry"/>
<field name="OptionalModules" units="" type="enum" elementnames="CameraStabilization,GPS" options="Disabled,Enabled" defaultvalue="Disabled"/> <field name="OptionalModules" units="" type="enum" elementnames="CameraStabilization,GPS" options="Disabled,Enabled" defaultvalue="Disabled"/>
<field name="DSMxBind" units="" type="uint8" elements="1" defaultvalue="0"/>
<access gcs="readwrite" flight="readwrite"/> <access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/> <telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/> <telemetryflight acked="true" updatemode="onchange" period="0"/>