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
8f3d2001
Commit
8f3d2001
authored
Dec 30, 2017
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set defaults even when param is not shown
parent
73d856d5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
22 deletions
+46
-22
MissionCommandTreeTest.cc
src/MissionManager/MissionCommandTreeTest.cc
+21
-8
MissionCommandUIInfo.cc
src/MissionManager/MissionCommandUIInfo.cc
+9
-5
MissionCommandUIInfo.h
src/MissionManager/MissionCommandUIInfo.h
+5
-2
SimpleMissionItem.cc
src/MissionManager/SimpleMissionItem.cc
+11
-7
No files found.
src/MissionManager/MissionCommandTreeTest.cc
View file @
8f3d2001
...
...
@@ -70,7 +70,9 @@ void MissionCommandTreeTest::_checkBaseValues(const MissionCommandUIInfo* uiInfo
QCOMPARE
(
uiInfo
->
isStandaloneCoordinate
(),
true
);
QCOMPARE
(
uiInfo
->
specifiesCoordinate
(),
true
);
for
(
int
i
=
1
;
i
<=
7
;
i
++
)
{
const
MissionCmdParamInfo
*
paramInfo
=
uiInfo
->
getParamInfo
(
i
);
bool
showUI
;
const
MissionCmdParamInfo
*
paramInfo
=
uiInfo
->
getParamInfo
(
i
,
showUI
);
QVERIFY
(
showUI
);
QVERIFY
(
paramInfo
);
QCOMPARE
(
paramInfo
->
decimalPlaces
(),
1
);
QCOMPARE
(
paramInfo
->
defaultValue
(),
1.0
);
...
...
@@ -91,7 +93,9 @@ void MissionCommandTreeTest::_checkOverrideParamValues(const MissionCommandUIInf
{
QString
overrideString
=
QString
(
"override fw %1 %2"
).
arg
(
command
).
arg
(
paramIndex
);
const
MissionCmdParamInfo
*
paramInfo
=
uiInfo
->
getParamInfo
(
paramIndex
);
bool
showUI
;
const
MissionCmdParamInfo
*
paramInfo
=
uiInfo
->
getParamInfo
(
paramIndex
,
showUI
);
QVERIFY
(
showUI
);
QVERIFY
(
paramInfo
);
QCOMPARE
(
paramInfo
->
decimalPlaces
(),
1
);
QCOMPARE
(
paramInfo
->
defaultValue
(),
1.0
);
...
...
@@ -109,6 +113,7 @@ void MissionCommandTreeTest::_checkOverrideParamValues(const MissionCommandUIInf
// Verifies that values match settings for an override
void
MissionCommandTreeTest
::
_checkOverrideValues
(
const
MissionCommandUIInfo
*
uiInfo
,
int
command
)
{
bool
showUI
;
QString
overrideString
=
QString
(
"override fw %1"
).
arg
(
command
);
QVERIFY
(
uiInfo
!=
NULL
);
...
...
@@ -121,9 +126,12 @@ void MissionCommandTreeTest::_checkOverrideValues(const MissionCommandUIInfo* ui
QCOMPARE
(
uiInfo
->
friendlyName
(),
_friendlyName
(
command
));
QCOMPARE
(
uiInfo
->
isStandaloneCoordinate
(),
false
);
QCOMPARE
(
uiInfo
->
specifiesCoordinate
(),
false
);
QVERIFY
(
uiInfo
->
getParamInfo
(
2
)
==
NULL
);
QVERIFY
(
uiInfo
->
getParamInfo
(
4
)
==
NULL
);
QVERIFY
(
uiInfo
->
getParamInfo
(
6
)
==
NULL
);
QVERIFY
(
uiInfo
->
getParamInfo
(
2
,
showUI
));
QCOMPARE
(
showUI
,
false
);
QVERIFY
(
uiInfo
->
getParamInfo
(
4
,
showUI
));
QCOMPARE
(
showUI
,
false
);
QVERIFY
(
uiInfo
->
getParamInfo
(
6
,
showUI
));
QCOMPARE
(
showUI
,
false
);
_checkOverrideParamValues
(
uiInfo
,
command
,
1
);
_checkOverrideParamValues
(
uiInfo
,
command
,
3
);
_checkOverrideParamValues
(
uiInfo
,
command
,
5
);
...
...
@@ -131,6 +139,8 @@ void MissionCommandTreeTest::_checkOverrideValues(const MissionCommandUIInfo* ui
void
MissionCommandTreeTest
::
testJsonLoad
(
void
)
{
bool
showUI
;
// Test loading from the bad command list
MissionCommandList
*
commandList
=
_commandTree
->
_staticCommandTree
[
MAV_AUTOPILOT_GENERIC
][
MAV_TYPE_GENERIC
];
QVERIFY
(
commandList
!=
NULL
);
...
...
@@ -148,14 +158,16 @@ void MissionCommandTreeTest::testJsonLoad(void)
QCOMPARE
(
uiInfo
->
isStandaloneCoordinate
(),
false
);
QCOMPARE
(
uiInfo
->
specifiesCoordinate
(),
false
);
for
(
int
i
=
1
;
i
<=
7
;
i
++
)
{
QVERIFY
(
uiInfo
->
getParamInfo
(
i
)
==
NULL
);
QVERIFY
(
uiInfo
->
getParamInfo
(
i
,
showUI
)
==
NULL
);
QCOMPARE
(
showUI
,
false
);
}
// Command 2 should all values defaulted for param 1
uiInfo
=
commandList
->
getUIInfo
((
MAV_CMD
)
2
);
QVERIFY
(
uiInfo
!=
NULL
);
const
MissionCmdParamInfo
*
paramInfo
=
uiInfo
->
getParamInfo
(
1
);
const
MissionCmdParamInfo
*
paramInfo
=
uiInfo
->
getParamInfo
(
1
,
showUI
);
QVERIFY
(
paramInfo
);
QCOMPARE
(
showUI
,
true
);
QCOMPARE
(
paramInfo
->
decimalPlaces
(),
-
1
);
QCOMPARE
(
paramInfo
->
defaultValue
(),
0.0
);
QCOMPARE
(
paramInfo
->
enumStrings
().
count
(),
0
);
...
...
@@ -164,7 +176,8 @@ void MissionCommandTreeTest::testJsonLoad(void)
QCOMPARE
(
paramInfo
->
param
(),
1
);
QVERIFY
(
paramInfo
->
units
().
isEmpty
());
for
(
int
i
=
2
;
i
<=
7
;
i
++
)
{
QVERIFY
(
uiInfo
->
getParamInfo
(
i
)
==
NULL
);
QVERIFY
(
uiInfo
->
getParamInfo
(
i
,
showUI
)
==
NULL
);
QCOMPARE
(
showUI
,
false
);
}
// Command 3 should have all values set
...
...
src/MissionManager/MissionCommandUIInfo.cc
View file @
8f3d2001
...
...
@@ -407,11 +407,15 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
return
true
;
}
const
MissionCmdParamInfo
*
MissionCommandUIInfo
::
getParamInfo
(
int
index
)
const
const
MissionCmdParamInfo
*
MissionCommandUIInfo
::
getParamInfo
(
int
index
,
bool
&
showUI
)
const
{
if
(
!
_paramRemoveList
.
contains
(
index
)
&&
_paramInfoMap
.
contains
(
index
))
{
return
_paramInfoMap
[
index
];
}
else
{
return
NULL
;
const
MissionCmdParamInfo
*
paramInfo
=
NULL
;
if
(
_paramInfoMap
.
contains
(
index
))
{
paramInfo
=
_paramInfoMap
[
index
]
;
}
showUI
=
(
paramInfo
!=
NULL
)
&&
!
_paramRemoveList
.
contains
(
index
);
return
paramInfo
;
}
src/MissionManager/MissionCommandUIInfo.h
View file @
8f3d2001
...
...
@@ -138,8 +138,11 @@ public:
/// @return true: success, false: failure, errorString set
bool
loadJsonInfo
(
const
QJsonObject
&
jsonObject
,
bool
requireFullObject
,
QString
&
errorString
);
/// Return param info for index, NULL for param should not be shown
const
MissionCmdParamInfo
*
getParamInfo
(
int
index
)
const
;
/// Retruns parameter information for specified parameter
/// @param index paremeter index to retrieve, 1-7
/// @param showUI true: show parameter in editor, false: hide parameter in editor
/// @return Param info for index, NULL for none available
const
MissionCmdParamInfo
*
getParamInfo
(
int
index
,
bool
&
showUI
)
const
;
private:
QString
_loadErrorString
(
const
QString
&
errorString
)
const
;
...
...
src/MissionManager/SimpleMissionItem.cc
View file @
8f3d2001
...
...
@@ -414,9 +414,10 @@ void SimpleMissionItem::_rebuildTextFieldFacts(void)
const
MissionCommandUIInfo
*
uiInfo
=
_commandTree
->
getUIInfo
(
_vehicle
,
command
);
for
(
int
i
=
1
;
i
<=
7
;
i
++
)
{
const
MissionCmdParamInfo
*
paramInfo
=
uiInfo
->
getParamInfo
(
i
);
bool
showUI
;
const
MissionCmdParamInfo
*
paramInfo
=
uiInfo
->
getParamInfo
(
i
,
showUI
);
if
(
paramInfo
&&
paramInfo
->
enumStrings
().
count
()
==
0
&&
!
paramInfo
->
nanUnchanged
())
{
if
(
showUI
&&
paramInfo
&&
paramInfo
->
enumStrings
().
count
()
==
0
&&
!
paramInfo
->
nanUnchanged
())
{
Fact
*
paramFact
=
rgParamFacts
[
i
-
1
];
FactMetaData
*
paramMetaData
=
rgParamMetaData
[
i
-
1
];
...
...
@@ -458,9 +459,10 @@ void SimpleMissionItem::_rebuildNaNFacts(void)
const
MissionCommandUIInfo
*
uiInfo
=
_commandTree
->
getUIInfo
(
_vehicle
,
command
);
for
(
int
i
=
1
;
i
<=
7
;
i
++
)
{
const
MissionCmdParamInfo
*
paramInfo
=
uiInfo
->
getParamInfo
(
i
);
bool
showUI
;
const
MissionCmdParamInfo
*
paramInfo
=
uiInfo
->
getParamInfo
(
i
,
showUI
);
if
(
paramInfo
&&
paramInfo
->
nanUnchanged
())
{
if
(
showUI
&&
paramInfo
&&
paramInfo
->
nanUnchanged
())
{
// Show hide Heading field on waypoint based on vehicle yaw to next waypoint setting. This needs to come from the actual vehicle if it exists
// and not _vehicle which is always offline.
Vehicle
*
firmwareVehicle
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
();
...
...
@@ -517,9 +519,10 @@ void SimpleMissionItem::_rebuildComboBoxFacts(void)
}
for
(
int
i
=
1
;
i
<=
7
;
i
++
)
{
const
MissionCmdParamInfo
*
paramInfo
=
_commandTree
->
getUIInfo
(
_vehicle
,
command
)
->
getParamInfo
(
i
);
bool
showUI
;
const
MissionCmdParamInfo
*
paramInfo
=
_commandTree
->
getUIInfo
(
_vehicle
,
command
)
->
getParamInfo
(
i
,
showUI
);
if
(
paramInfo
&&
paramInfo
->
enumStrings
().
count
()
!=
0
)
{
if
(
showUI
&&
paramInfo
&&
paramInfo
->
enumStrings
().
count
()
!=
0
)
{
Fact
*
paramFact
=
rgParamFacts
[
i
-
1
];
FactMetaData
*
paramMetaData
=
rgParamMetaData
[
i
-
1
];
...
...
@@ -635,7 +638,8 @@ void SimpleMissionItem::setDefaultsForCommand(void)
const
MissionCommandUIInfo
*
uiInfo
=
_commandTree
->
getUIInfo
(
_vehicle
,
command
);
if
(
uiInfo
)
{
for
(
int
i
=
1
;
i
<=
7
;
i
++
)
{
const
MissionCmdParamInfo
*
paramInfo
=
uiInfo
->
getParamInfo
(
i
);
bool
showUI
;
const
MissionCmdParamInfo
*
paramInfo
=
uiInfo
->
getParamInfo
(
i
,
showUI
);
if
(
paramInfo
)
{
Fact
*
rgParamFacts
[
7
]
=
{
&
_missionItem
.
_param1Fact
,
&
_missionItem
.
_param2Fact
,
&
_missionItem
.
_param3Fact
,
&
_missionItem
.
_param4Fact
,
&
_missionItem
.
_param5Fact
,
&
_missionItem
.
_param6Fact
,
&
_missionItem
.
_param7Fact
};
rgParamFacts
[
paramInfo
->
param
()
-
1
]
->
setRawValue
(
paramInfo
->
defaultValue
());
...
...
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