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
ee8193f3
Unverified
Commit
ee8193f3
authored
Jan 17, 2020
by
Gus Grubba
Committed by
GitHub
Jan 17, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8233 from mavlink/pr-low-battery-warning-timer
Add a timer in between low battery warning messages.
parents
7e9b1e85
19522759
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
Vehicle.cc
src/Vehicle/Vehicle.cc
+11
-5
Vehicle.h
src/Vehicle/Vehicle.h
+2
-1
No files found.
src/Vehicle/Vehicle.cc
View file @
ee8193f3
...
...
@@ -300,6 +300,7 @@ Vehicle::Vehicle(LinkInterface* link,
// Start csv logger
connect
(
&
_csvLogTimer
,
&
QTimer
::
timeout
,
this
,
&
Vehicle
::
_writeCsvLine
);
_csvLogTimer
.
start
(
1000
);
_lastBatteryAnnouncement
.
start
();
}
// Disconnected Vehicle for offline editing
...
...
@@ -1126,7 +1127,7 @@ void Vehicle::_handleAttitudeQuaternion(mavlink_message_t& message)
// if repr_offset is valid, rotate attitude and rates
if
(
repr_offset
.
norm
()
>=
0.5
f
)
{
quat
=
quat
*
repr_offset
;
rates
=
repr_offset
*
rates
;
rates
=
repr_offset
*
rates
;
}
float
roll
,
pitch
,
yaw
;
...
...
@@ -1550,12 +1551,16 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message)
}
_battery1FactGroup
.
percentRemaining
()
->
setRawValue
(
sysStatus
.
battery_remaining
);
//-- Low battery warning
if
(
sysStatus
.
battery_remaining
>
0
)
{
if
(
sysStatus
.
battery_remaining
<
_settingsManager
->
appSettings
()
->
batteryPercentRemainingAnnounce
()
->
rawValue
().
toInt
()
&&
sysStatus
.
battery_remaining
<
_lastAnnouncedLowBatteryPercent
)
{
int
warnThreshold
=
_settingsManager
->
appSettings
()
->
batteryPercentRemainingAnnounce
()
->
rawValue
().
toInt
();
if
(
sysStatus
.
battery_remaining
<
warnThreshold
&&
sysStatus
.
battery_remaining
<
_lastAnnouncedLowBatteryPercent
&&
_lastBatteryAnnouncement
.
elapsed
()
>
(
sysStatus
.
battery_remaining
<
warnThreshold
*
0.5
?
15000
:
30000
))
{
_say
(
tr
(
"%1 low battery: %2 percent remaining"
).
arg
(
_vehicleIdSpeech
()).
arg
(
sysStatus
.
battery_remaining
));
_lastBatteryAnnouncement
.
start
();
_lastAnnouncedLowBatteryPercent
=
sysStatus
.
battery_remaining
;
}
_lastAnnouncedLowBatteryPercent
=
sysStatus
.
battery_remaining
;
}
if
(
_onboardControlSensorsPresent
!=
sysStatus
.
onboard_control_sensors_present
)
{
...
...
@@ -1656,12 +1661,13 @@ void Vehicle::_updateArmed(bool armed)
if
(
_armed
!=
armed
)
{
_armed
=
armed
;
emit
armedChanged
(
_armed
);
// We are transitioning to the armed state, begin tracking trajectory points for the map
if
(
_armed
)
{
_trajectoryPoints
->
start
();
_flightTimerStart
();
_clearCameraTriggerPoints
();
// Reset battery warning
_lastAnnouncedLowBatteryPercent
=
100
;
}
else
{
_trajectoryPoints
->
stop
();
_flightTimerStop
();
...
...
src/Vehicle/Vehicle.h
View file @
ee8193f3
...
...
@@ -1507,7 +1507,8 @@ private:
QString
_gitHash
;
quint64
_uid
;
int
_lastAnnouncedLowBatteryPercent
;
QTime
_lastBatteryAnnouncement
;
int
_lastAnnouncedLowBatteryPercent
;
SharedLinkInterfacePointer
_priorityLink
;
// We always keep a reference to the priority link to manage shutdown ordering
bool
_priorityLinkCommanded
;
...
...
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