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
0b5fb0dc
Commit
0b5fb0dc
authored
Oct 08, 2018
by
Willian Galvani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FirmwarePlugin, Vehicle: implement helper to check version number
parent
6d622f4c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
0 deletions
+52
-0
FirmwarePlugin.cc
src/FirmwarePlugin/FirmwarePlugin.cc
+32
-0
FirmwarePlugin.h
src/FirmwarePlugin/FirmwarePlugin.h
+5
-0
Vehicle.cc
src/Vehicle/Vehicle.cc
+10
-0
Vehicle.h
src/Vehicle/Vehicle.h
+5
-0
No files found.
src/FirmwarePlugin/FirmwarePlugin.cc
View file @
0b5fb0dc
...
...
@@ -740,3 +740,35 @@ void FirmwarePlugin::_versionFileDownloadFinished(QString& remoteFile, QString&
qgcApp
()
->
showMessage
(
message
.
arg
(
vehicle
->
firmwareVersionTypeString
(),
currentVersion
,
version
));
}
}
int
FirmwarePlugin
::
versionCompare
(
Vehicle
*
vehicle
,
int
major
,
int
minor
,
int
patch
)
{
int
currMajor
=
vehicle
->
firmwareMajorVersion
();
int
currMinor
=
vehicle
->
firmwareMinorVersion
();
int
currPatch
=
vehicle
->
firmwarePatchVersion
();
if
(
currMajor
==
major
&&
currMinor
==
minor
&&
currPatch
==
patch
)
{
return
0
;
}
if
(
currMajor
>
major
||
(
currMajor
==
major
&&
currMinor
>
minor
)
||
(
currMajor
==
major
&&
currMinor
==
minor
&&
currPatch
>
patch
))
{
return
1
;
}
return
-
1
;
}
int
FirmwarePlugin
::
versionCompare
(
Vehicle
*
vehicle
,
QString
&
compare
)
{
QStringList
versionNumbers
=
compare
.
split
(
"."
);
if
(
versionNumbers
.
size
()
!=
3
)
{
qCWarning
(
FirmwarePluginLog
)
<<
"Error parsing version number: wrong format"
;
return
-
1
;
}
int
major
=
versionNumbers
[
0
].
toInt
();
int
minor
=
versionNumbers
[
1
].
toInt
();
int
patch
=
versionNumbers
[
2
].
toInt
();
return
versionCompare
(
vehicle
,
major
,
minor
,
patch
);
}
src/FirmwarePlugin/FirmwarePlugin.h
View file @
0b5fb0dc
...
...
@@ -309,6 +309,11 @@ public:
/// Used to check if running firmware is latest stable version.
virtual
void
checkIfIsLatestStable
(
Vehicle
*
vehicle
);
/// Used to check if running current version is equal or higher than the one being compared.
/// returns 1 if current > compare, 0 if current == compare, -1 if current < compare
int
versionCompare
(
Vehicle
*
vehicle
,
QString
&
compare
);
int
versionCompare
(
Vehicle
*
vehicle
,
int
major
,
int
minor
,
int
patch
);
// FIXME: Hack workaround for non pluginize FollowMe support
static
const
QString
px4FollowMeFlightMode
;
...
...
src/Vehicle/Vehicle.cc
View file @
0b5fb0dc
...
...
@@ -3770,6 +3770,16 @@ void Vehicle::_mavlinkMessageStatus(int uasId, uint64_t totalSent, uint64_t tota
}
}
int
Vehicle
::
versionCompare
(
QString
&
compare
)
{
return
_firmwarePlugin
->
versionCompare
(
this
,
compare
);
}
int
Vehicle
::
versionCompare
(
int
major
,
int
minor
,
int
patch
)
{
return
_firmwarePlugin
->
versionCompare
(
this
,
major
,
minor
,
patch
);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
...
...
src/Vehicle/Vehicle.h
View file @
0b5fb0dc
...
...
@@ -746,6 +746,11 @@ public:
Q_INVOKABLE
void
triggerCamera
(
void
);
Q_INVOKABLE
void
sendPlan
(
QString
planFile
);
/// Used to check if running current version is equal or higher than the one being compared.
// returns 1 if current > compare, 0 if current == compare, -1 if current < compare
Q_INVOKABLE
int
versionCompare
(
QString
&
compare
);
Q_INVOKABLE
int
versionCompare
(
int
major
,
int
minor
,
int
patch
);
/// Test motor
/// @param motor Motor number, 1-based
/// @param percent 0-no power, 100-full power
...
...
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