Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
825ba9e4
Commit
825ba9e4
authored
Mar 23, 2018
by
DonLakeFlyer
Browse files
Fix v1/v2 load semantics
parent
cf237be6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/MissionManager/FixedWingLandingComplexItem.cc
View file @
825ba9e4
...
@@ -166,6 +166,14 @@ bool FixedWingLandingComplexItem::load(const QJsonObject& complexObject, int seq
...
@@ -166,6 +166,14 @@ bool FixedWingLandingComplexItem::load(const QJsonObject& complexObject, int seq
int
version
=
complexObject
[
JsonHelper
::
jsonVersionKey
].
toInt
();
int
version
=
complexObject
[
JsonHelper
::
jsonVersionKey
].
toInt
();
if
(
version
==
1
)
{
if
(
version
==
1
)
{
QList
<
JsonHelper
::
KeyValidateInfo
>
v1KeyInfoList
=
{
{
_jsonLoiterAltitudeRelativeKey
,
QJsonValue
::
Bool
,
true
},
{
_jsonLandingAltitudeRelativeKey
,
QJsonValue
::
Bool
,
true
},
};
if
(
!
JsonHelper
::
validateKeys
(
complexObject
,
v1KeyInfoList
,
errorString
))
{
return
false
;
}
bool
loiterAltitudeRelative
=
complexObject
[
_jsonLoiterAltitudeRelativeKey
].
toBool
();
bool
loiterAltitudeRelative
=
complexObject
[
_jsonLoiterAltitudeRelativeKey
].
toBool
();
bool
landingAltitudeRelative
=
complexObject
[
_jsonLandingAltitudeRelativeKey
].
toBool
();
bool
landingAltitudeRelative
=
complexObject
[
_jsonLandingAltitudeRelativeKey
].
toBool
();
if
(
loiterAltitudeRelative
!=
landingAltitudeRelative
)
{
if
(
loiterAltitudeRelative
!=
landingAltitudeRelative
)
{
...
@@ -176,13 +184,19 @@ bool FixedWingLandingComplexItem::load(const QJsonObject& complexObject, int seq
...
@@ -176,13 +184,19 @@ bool FixedWingLandingComplexItem::load(const QJsonObject& complexObject, int seq
}
else
{
}
else
{
_altitudesAreRelative
=
loiterAltitudeRelative
;
_altitudesAreRelative
=
loiterAltitudeRelative
;
}
}
_valueSetIsDistance
=
true
;
}
else
if
(
version
==
2
)
{
}
else
if
(
version
==
2
)
{
QList
<
JsonHelper
::
KeyValidateInfo
>
v2KeyInfoList
=
{
QList
<
JsonHelper
::
KeyValidateInfo
>
v2KeyInfoList
=
{
{
_jsonAltitudesAreRelativeKey
,
QJsonValue
::
Bool
,
true
},
{
_jsonAltitudesAreRelativeKey
,
QJsonValue
::
Bool
,
true
},
{
_jsonValueSetIsDistanceKey
,
QJsonValue
::
Bool
,
true
},
};
};
if
(
!
JsonHelper
::
validateKeys
(
complexObject
,
v2KeyInfoList
,
errorString
))
{
if
(
!
JsonHelper
::
validateKeys
(
complexObject
,
v2KeyInfoList
,
errorString
))
{
_ignoreRecalcSignals
=
false
;
return
false
;
return
false
;
}
}
_altitudesAreRelative
=
complexObject
[
_jsonAltitudesAreRelativeKey
].
toBool
();
_valueSetIsDistance
=
complexObject
[
_jsonValueSetIsDistanceKey
].
toBool
();
}
else
{
}
else
{
errorString
=
tr
(
"%1 complex item version %2 not supported"
).
arg
(
jsonComplexItemTypeValue
).
arg
(
version
);
errorString
=
tr
(
"%1 complex item version %2 not supported"
).
arg
(
jsonComplexItemTypeValue
).
arg
(
version
);
_ignoreRecalcSignals
=
false
;
_ignoreRecalcSignals
=
false
;
...
@@ -204,7 +218,8 @@ bool FixedWingLandingComplexItem::load(const QJsonObject& complexObject, int seq
...
@@ -204,7 +218,8 @@ bool FixedWingLandingComplexItem::load(const QJsonObject& complexObject, int seq
_loiterRadiusFact
.
setRawValue
(
complexObject
[
_jsonLoiterRadiusKey
].
toDouble
());
_loiterRadiusFact
.
setRawValue
(
complexObject
[
_jsonLoiterRadiusKey
].
toDouble
());
_loiterClockwise
=
complexObject
[
_jsonLoiterClockwiseKey
].
toBool
();
_loiterClockwise
=
complexObject
[
_jsonLoiterClockwiseKey
].
toBool
();
_altitudesAreRelative
=
complexObject
[
_jsonAltitudesAreRelativeKey
].
toBool
();
_calcGlideSlope
();
_landingCoordSet
=
true
;
_landingCoordSet
=
true
;
...
@@ -328,6 +343,8 @@ bool FixedWingLandingComplexItem::scanForItem(QmlObjectListModel* visualItems, V
...
@@ -328,6 +343,8 @@ bool FixedWingLandingComplexItem::scanForItem(QmlObjectListModel* visualItems, V
complexItem
->
_landingCoordinate
.
setLongitude
(
missionItemLand
.
param6
());
complexItem
->
_landingCoordinate
.
setLongitude
(
missionItemLand
.
param6
());
complexItem
->
_landingAltitudeFact
.
setRawValue
(
missionItemLand
.
param7
());
complexItem
->
_landingAltitudeFact
.
setRawValue
(
missionItemLand
.
param7
());
complexItem
->
_calcGlideSlope
();
complexItem
->
_landingCoordSet
=
true
;
complexItem
->
_landingCoordSet
=
true
;
complexItem
->
_ignoreRecalcSignals
=
false
;
complexItem
->
_ignoreRecalcSignals
=
false
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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