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
fc56fe64
Commit
fc56fe64
authored
Nov 10, 2017
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding access to the vehicle hobbs meter
parent
8ed1e60c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
Vehicle.cc
src/Vehicle/Vehicle.cc
+19
-0
Vehicle.h
src/Vehicle/Vehicle.h
+4
-0
No files found.
src/Vehicle/Vehicle.cc
View file @
fc56fe64
...
...
@@ -2873,6 +2873,25 @@ void Vehicle::sendPlan(QString planFile)
PlanMasterController
::
sendPlanToVehicle
(
this
,
planFile
);
}
QString
Vehicle
::
hobbsMeter
()
{
static
const
char
*
HOOBS_HI
=
"LND_FLIGHT_T_HI"
;
static
const
char
*
HOOBS_LO
=
"LND_FLIGHT_T_LO"
;
//-- TODO: Does this exist on non PX4?
if
(
_parameterManager
->
parameterExists
(
FactSystem
::
defaultComponentId
,
HOOBS_HI
)
&&
_parameterManager
->
parameterExists
(
FactSystem
::
defaultComponentId
,
HOOBS_LO
))
{
Fact
*
factHi
=
_parameterManager
->
getParameter
(
FactSystem
::
defaultComponentId
,
HOOBS_HI
);
Fact
*
factLo
=
_parameterManager
->
getParameter
(
FactSystem
::
defaultComponentId
,
HOOBS_LO
);
uint64_t
hobbsTimeSeconds
=
((
uint64_t
)
factHi
->
rawValue
().
toUInt
()
<<
32
|
(
uint64_t
)
factLo
->
rawValue
().
toUInt
())
/
1000000
;
int
hours
=
hobbsTimeSeconds
/
3600
;
int
minutes
=
(
hobbsTimeSeconds
%
3600
)
/
60
;
int
seconds
=
hobbsTimeSeconds
%
60
;
QString
timeStr
;
timeStr
.
sprintf
(
"%04d:%02d:%02d"
,
hours
,
minutes
,
seconds
);
return
timeStr
;
}
return
QString
(
"0000:00:00"
);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
...
...
src/Vehicle/Vehicle.h
View file @
fc56fe64
...
...
@@ -319,6 +319,7 @@ public:
Q_PROPERTY
(
bool
initialPlanRequestComplete
READ
initialPlanRequestComplete
NOTIFY
initialPlanRequestCompleteChanged
)
Q_PROPERTY
(
QVariantList
staticCameraList
READ
staticCameraList
CONSTANT
)
Q_PROPERTY
(
QGCCameraManager
*
dynamicCameras
READ
dynamicCameras
NOTIFY
dynamicCamerasChanged
)
Q_PROPERTY
(
QString
hobbsMeter
READ
hobbsMeter
NOTIFY
hobbsMeterChanged
)
// Vehicle state used for guided control
Q_PROPERTY
(
bool
flying
READ
flying
NOTIFY
flyingChanged
)
///< Vehicle is flying
...
...
@@ -690,7 +691,9 @@ public:
bool
capabilitiesKnown
(
void
)
const
{
return
_vehicleCapabilitiesKnown
;
}
uint64_t
capabilityBits
(
void
)
const
{
return
_capabilityBits
;
}
// Change signalled by capabilityBitsChanged
QGCCameraManager
*
dynamicCameras
()
{
return
_cameras
;
}
QString
hobbsMeter
();
/// @true: When flying a mission the vehicle is always facing towards the next waypoint
bool
vehicleYawsToNextWaypointInMission
(
void
)
const
;
...
...
@@ -736,6 +739,7 @@ signals:
void
firmwareTypeChanged
(
void
);
void
vehicleTypeChanged
(
void
);
void
dynamicCamerasChanged
();
void
hobbsMeterChanged
();
void
capabilitiesKnownChanged
(
bool
capabilitiesKnown
);
void
initialPlanRequestCompleteChanged
(
bool
initialPlanRequestComplete
);
void
capabilityBitsChanged
(
uint64_t
capabilityBits
);
...
...
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