Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
ea8b11f5
Commit
ea8b11f5
authored
Jul 26, 2013
by
Geoff Fink
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:gefink/qgroundcontrol
parents
b3f2af3c
e991326e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
39 deletions
+61
-39
UAS.cc
src/uas/UAS.cc
+41
-26
UAS.h
src/uas/UAS.h
+2
-2
QGCParamWidget.cc
src/ui/QGCParamWidget.cc
+7
-5
UASControlWidget.cc
src/ui/uas/UASControlWidget.cc
+11
-6
No files found.
src/uas/UAS.cc
View file @
ea8b11f5
...
@@ -38,7 +38,10 @@
...
@@ -38,7 +38,10 @@
* as the previous one created unless one calls deleteSettings in the code after
* as the previous one created unless one calls deleteSettings in the code after
* creating the UAS.
* creating the UAS.
*/
*/
UAS
::
UAS
(
MAVLinkProtocol
*
protocol
,
int
id
)
:
UASInterface
(),
UAS
::
UAS
(
MAVLinkProtocol
*
protocol
,
int
id
)
:
UASInterface
(),
lipoFull
(
4.2
f
),
lipoEmpty
(
3.5
f
),
uasId
(
id
),
uasId
(
id
),
links
(
new
QList
<
LinkInterface
*>
()),
links
(
new
QList
<
LinkInterface
*>
()),
unknownPackets
(),
unknownPackets
(),
...
@@ -3325,45 +3328,55 @@ QString UAS::getAudioModeTextFor(int id)
...
@@ -3325,45 +3328,55 @@ QString UAS::getAudioModeTextFor(int id)
return
mode
;
return
mode
;
}
}
/**
* The mode returned can be auto, stabilized, test, manual, preflight or unknown.
* @return the short text of the mode for the id given.
*/
/**
/**
* The mode returned can be auto, stabilized, test, manual, preflight or unknown.
* The mode returned can be auto, stabilized, test, manual, preflight or unknown.
* @return the short text of the mode for the id given.
* @return the short text of the mode for the id given.
*/
*/
QString
UAS
::
getShortModeTextFor
(
int
id
)
QString
UAS
::
getShortModeTextFor
(
int
id
)
{
{
QString
mode
;
QString
mode
=
""
;
uint8_t
modeid
=
id
;
uint8_t
modeid
=
id
;
qDebug
()
<<
"MODE:"
<<
modeid
;
// BASE MODE DECODING
// BASE MODE DECODING
if
(
modeid
&
(
uint8_t
)
MAV_MODE_FLAG_DECODE_POSITION_AUTO
)
if
(
modeid
==
0
)
{
{
mode
=
"|PREFLIGHT"
;
}
else
{
if
(
modeid
&
(
uint8_t
)
MAV_MODE_FLAG_DECODE_POSITION_AUTO
){
mode
+=
"|AUTO"
;
mode
+=
"|AUTO"
;
}
}
else
if
(
modeid
&
(
uint8_t
)
MAV_MODE_FLAG_DECODE_POSITION_GUIDED
)
{
if
(
modeid
&
(
uint8_t
)
MAV_MODE_FLAG_DECODE_POSITION_MANUAL
){
mode
+=
"|MANUAL"
;
}
if
(
modeid
&
(
uint8_t
)
MAV_MODE_FLAG_DECODE_POSITION_GUIDED
){
mode
+=
"|VECTOR"
;
mode
+=
"|VECTOR"
;
}
}
if
(
modeid
&
(
uint8_t
)
MAV_MODE_FLAG_DECODE_POSITION_STABILIZE
)
{
if
(
modeid
&
(
uint8_t
)
MAV_MODE_FLAG_DECODE_POSITION_STABILIZE
)
{
mode
+=
"|STABILIZED"
;
mode
+=
"|STABILIZED"
;
}
}
else
if
(
modeid
&
(
uint8_t
)
MAV_MODE_FLAG_DECODE_POSITION_TEST
)
{
if
(
modeid
&
(
uint8_t
)
MAV_MODE_FLAG_DECODE_POSITION_TEST
){
mode
+=
"|TEST"
;
mode
+=
"|TEST"
;
}
}
else
if
(
modeid
&
(
uint8_t
)
MAV_MODE_FLAG_DECODE_POSITION_MANUAL
)
{
mode
+=
"|MANUAL"
;
}
else
if
(
modeid
==
0
)
{
mode
=
"|PREFLIGHT"
;
}
}
else
if
(
mode
.
length
()
==
0
)
{
{
mode
=
"|UNKNOWN"
;
mode
=
"|UNKNOWN"
;
qDebug
()
<<
__FILE__
<<
__LINE__
<<
" Unknown modeid: "
<<
modeid
;
}
}
// ARMED STATE DECODING
// ARMED STATE DECODING
...
@@ -3382,6 +3395,8 @@ QString UAS::getShortModeTextFor(int id)
...
@@ -3382,6 +3395,8 @@ QString UAS::getShortModeTextFor(int id)
mode
.
prepend
(
"HIL:"
);
mode
.
prepend
(
"HIL:"
);
}
}
qDebug
()
<<
"MODE: "
<<
modeid
<<
" "
<<
mode
;
return
mode
;
return
mode
;
}
}
...
@@ -3445,8 +3460,8 @@ void UAS::setBattery(BatteryType type, int cells)
...
@@ -3445,8 +3460,8 @@ void UAS::setBattery(BatteryType type, int cells)
case
LIION
:
case
LIION
:
break
;
break
;
case
LIPOLY
:
case
LIPOLY
:
fullVoltage
=
this
->
cells
*
UAS
::
lipoFull
;
fullVoltage
=
this
->
cells
*
lipoFull
;
emptyVoltage
=
this
->
cells
*
UAS
::
lipoEmpty
;
emptyVoltage
=
this
->
cells
*
lipoEmpty
;
break
;
break
;
case
LIFE
:
case
LIFE
:
break
;
break
;
...
...
src/uas/UAS.h
View file @
ea8b11f5
...
@@ -56,8 +56,8 @@ public:
...
@@ -56,8 +56,8 @@ public:
UAS
(
MAVLinkProtocol
*
protocol
,
int
id
=
0
);
UAS
(
MAVLinkProtocol
*
protocol
,
int
id
=
0
);
~
UAS
();
~
UAS
();
static
const
float
lipoFull
=
4
.
2
f
;
///< 100% charged voltage
float
lipoFull
;
///< 100% charged voltage
static
const
float
lipoEmpty
=
3
.
5
f
;
///< Discharged voltage
float
lipoEmpty
;
///< Discharged voltage
/* MANAGEMENT */
/* MANAGEMENT */
...
...
src/ui/QGCParamWidget.cc
View file @
ea8b11f5
...
@@ -705,7 +705,7 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column)
...
@@ -705,7 +705,7 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column)
current
->
setBackground
(
1
,
QBrush
(
QColor
(
QGC
::
colorOrange
)));
current
->
setBackground
(
1
,
QBrush
(
QColor
(
QGC
::
colorOrange
)));
}
}
switch
(
parameters
.
value
(
key
)
->
value
(
str
).
type
())
switch
(
(
int
)
parameters
.
value
(
key
)
->
value
(
str
).
type
())
{
{
case
QVariant
:
:
Int
:
case
QVariant
:
:
Int
:
{
{
...
@@ -766,7 +766,7 @@ void QGCParamWidget::saveParameters()
...
@@ -766,7 +766,7 @@ void QGCParamWidget::saveParameters()
{
{
QString
paramValue
(
"%1"
);
QString
paramValue
(
"%1"
);
QString
paramType
(
"%1"
);
QString
paramType
(
"%1"
);
switch
(
j
.
value
().
type
())
switch
(
(
int
)
j
.
value
().
type
())
{
{
case
QVariant
:
:
Int
:
case
QVariant
:
:
Int
:
paramValue
=
paramValue
.
arg
(
j
.
value
().
toInt
());
paramValue
=
paramValue
.
arg
(
j
.
value
().
toInt
());
...
@@ -777,7 +777,9 @@ void QGCParamWidget::saveParameters()
...
@@ -777,7 +777,9 @@ void QGCParamWidget::saveParameters()
paramType
=
paramType
.
arg
(
MAV_PARAM_TYPE_UINT32
);
paramType
=
paramType
.
arg
(
MAV_PARAM_TYPE_UINT32
);
break
;
break
;
case
QMetaType
:
:
Float
:
case
QMetaType
:
:
Float
:
paramValue
=
paramValue
.
arg
(
j
.
value
().
toDouble
(),
25
,
'g'
,
12
);
// We store parameters as floats, with only 6 digits of precision guaranteed for decimal string conversion
// (see IEEE 754, 32 bit single-precision)
paramValue
=
paramValue
.
arg
((
double
)
j
.
value
().
toFloat
(),
25
,
'g'
,
6
);
paramType
=
paramType
.
arg
(
MAV_PARAM_TYPE_REAL32
);
paramType
=
paramType
.
arg
(
MAV_PARAM_TYPE_REAL32
);
break
;
break
;
default:
default:
...
@@ -955,7 +957,7 @@ void QGCParamWidget::retransmissionGuardTick()
...
@@ -955,7 +957,7 @@ void QGCParamWidget::retransmissionGuardTick()
if
(
count
<
retransmissionBurstRequestSize
)
{
if
(
count
<
retransmissionBurstRequestSize
)
{
// Re-request write operation
// Re-request write operation
QVariant
value
=
missingParams
->
value
(
key
);
QVariant
value
=
missingParams
->
value
(
key
);
switch
(
parameters
.
value
(
component
)
->
value
(
key
).
type
())
switch
(
(
int
)
parameters
.
value
(
component
)
->
value
(
key
).
type
())
{
{
case
QVariant
:
:
Int
:
case
QVariant
:
:
Int
:
{
{
...
@@ -1020,7 +1022,7 @@ void QGCParamWidget::setParameter(int component, QString parameterName, QVariant
...
@@ -1020,7 +1022,7 @@ void QGCParamWidget::setParameter(int component, QString parameterName, QVariant
return
;
return
;
}
}
switch
(
parameters
.
value
(
component
)
->
value
(
parameterName
).
type
())
switch
(
(
int
)
parameters
.
value
(
component
)
->
value
(
parameterName
).
type
())
{
{
case
QVariant
:
:
Char
:
case
QVariant
:
:
Char
:
{
{
...
...
src/ui/uas/UASControlWidget.cc
View file @
ea8b11f5
...
@@ -51,12 +51,17 @@ UASControlWidget::UASControlWidget(QWidget *parent) : QWidget(parent),
...
@@ -51,12 +51,17 @@ UASControlWidget::UASControlWidget(QWidget *parent) : QWidget(parent),
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setUAS
(
UASInterface
*
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setUAS
(
UASInterface
*
)));
ui
.
modeComboBox
->
clear
();
ui
.
modeComboBox
->
clear
();
ui
.
modeComboBox
->
insertItem
(
0
,
UAS
::
getShortModeTextFor
(
MAV_MODE_PREFLIGHT
).
remove
(
0
,
2
),
MAV_MODE_PREFLIGHT
);
int
modes
[]
=
{
ui
.
modeComboBox
->
insertItem
(
1
,
UAS
::
getShortModeTextFor
((
MAV_MODE_FLAG_STABILIZE_ENABLED
|
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
)).
remove
(
0
,
2
),
(
MAV_MODE_FLAG_STABILIZE_ENABLED
|
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
));
MAV_MODE_PREFLIGHT
,
ui
.
modeComboBox
->
insertItem
(
2
,
UAS
::
getShortModeTextFor
(
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
).
remove
(
0
,
2
),
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
);
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
,
ui
.
modeComboBox
->
insertItem
(
3
,
UAS
::
getShortModeTextFor
((
MAV_MODE_FLAG_STABILIZE_ENABLED
|
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_GUIDED_ENABLED
)).
remove
(
0
,
2
),
(
MAV_MODE_FLAG_STABILIZE_ENABLED
|
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_GUIDED_ENABLED
));
MAV_MODE_FLAG_STABILIZE_ENABLED
|
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
,
ui
.
modeComboBox
->
insertItem
(
4
,
UAS
::
getShortModeTextFor
((
MAV_MODE_FLAG_STABILIZE_ENABLED
|
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_GUIDED_ENABLED
|
MAV_MODE_FLAG_AUTO_ENABLED
)).
remove
(
0
,
2
),
(
MAV_MODE_FLAG_STABILIZE_ENABLED
|
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_GUIDED_ENABLED
|
MAV_MODE_FLAG_AUTO_ENABLED
));
MAV_MODE_FLAG_STABILIZE_ENABLED
|
MAV_MODE_FLAG_AUTO_ENABLED
,
ui
.
modeComboBox
->
insertItem
(
5
,
UAS
::
getShortModeTextFor
((
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_TEST_ENABLED
)).
remove
(
0
,
2
),
(
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_TEST_ENABLED
));
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_TEST_ENABLED
,
};
for
(
int
i
=
0
;
i
<
sizeof
(
modes
)
/
sizeof
(
int
);
i
++
)
{
int
mode
=
modes
[
i
];
ui
.
modeComboBox
->
insertItem
(
i
,
UAS
::
getShortModeTextFor
(
mode
).
remove
(
0
,
2
),
mode
);
}
connect
(
ui
.
modeComboBox
,
SIGNAL
(
activated
(
int
)),
this
,
SLOT
(
setMode
(
int
)));
connect
(
ui
.
modeComboBox
,
SIGNAL
(
activated
(
int
)),
this
,
SLOT
(
setMode
(
int
)));
connect
(
ui
.
setModeButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
transmitMode
()));
connect
(
ui
.
setModeButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
transmitMode
()));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment