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
19522759
Commit
19522759
authored
Jan 17, 2020
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a timer in between low battery warning messages.
parent
7e9b1e85
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 @
19522759
...
@@ -300,6 +300,7 @@ Vehicle::Vehicle(LinkInterface* link,
...
@@ -300,6 +300,7 @@ Vehicle::Vehicle(LinkInterface* link,
// Start csv logger
// Start csv logger
connect
(
&
_csvLogTimer
,
&
QTimer
::
timeout
,
this
,
&
Vehicle
::
_writeCsvLine
);
connect
(
&
_csvLogTimer
,
&
QTimer
::
timeout
,
this
,
&
Vehicle
::
_writeCsvLine
);
_csvLogTimer
.
start
(
1000
);
_csvLogTimer
.
start
(
1000
);
_lastBatteryAnnouncement
.
start
();
}
}
// Disconnected Vehicle for offline editing
// Disconnected Vehicle for offline editing
...
@@ -1126,7 +1127,7 @@ void Vehicle::_handleAttitudeQuaternion(mavlink_message_t& message)
...
@@ -1126,7 +1127,7 @@ void Vehicle::_handleAttitudeQuaternion(mavlink_message_t& message)
// if repr_offset is valid, rotate attitude and rates
// if repr_offset is valid, rotate attitude and rates
if
(
repr_offset
.
norm
()
>=
0.5
f
)
{
if
(
repr_offset
.
norm
()
>=
0.5
f
)
{
quat
=
quat
*
repr_offset
;
quat
=
quat
*
repr_offset
;
rates
=
repr_offset
*
rates
;
rates
=
repr_offset
*
rates
;
}
}
float
roll
,
pitch
,
yaw
;
float
roll
,
pitch
,
yaw
;
...
@@ -1550,12 +1551,16 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message)
...
@@ -1550,12 +1551,16 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message)
}
}
_battery1FactGroup
.
percentRemaining
()
->
setRawValue
(
sysStatus
.
battery_remaining
);
_battery1FactGroup
.
percentRemaining
()
->
setRawValue
(
sysStatus
.
battery_remaining
);
//-- Low battery warning
if
(
sysStatus
.
battery_remaining
>
0
)
{
if
(
sysStatus
.
battery_remaining
>
0
)
{
if
(
sysStatus
.
battery_remaining
<
_settingsManager
->
appSettings
()
->
batteryPercentRemainingAnnounce
()
->
rawValue
().
toInt
()
&&
int
warnThreshold
=
_settingsManager
->
appSettings
()
->
batteryPercentRemainingAnnounce
()
->
rawValue
().
toInt
();
sysStatus
.
battery_remaining
<
_lastAnnouncedLowBatteryPercent
)
{
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
));
_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
)
{
if
(
_onboardControlSensorsPresent
!=
sysStatus
.
onboard_control_sensors_present
)
{
...
@@ -1656,12 +1661,13 @@ void Vehicle::_updateArmed(bool armed)
...
@@ -1656,12 +1661,13 @@ void Vehicle::_updateArmed(bool armed)
if
(
_armed
!=
armed
)
{
if
(
_armed
!=
armed
)
{
_armed
=
armed
;
_armed
=
armed
;
emit
armedChanged
(
_armed
);
emit
armedChanged
(
_armed
);
// We are transitioning to the armed state, begin tracking trajectory points for the map
// We are transitioning to the armed state, begin tracking trajectory points for the map
if
(
_armed
)
{
if
(
_armed
)
{
_trajectoryPoints
->
start
();
_trajectoryPoints
->
start
();
_flightTimerStart
();
_flightTimerStart
();
_clearCameraTriggerPoints
();
_clearCameraTriggerPoints
();
// Reset battery warning
_lastAnnouncedLowBatteryPercent
=
100
;
}
else
{
}
else
{
_trajectoryPoints
->
stop
();
_trajectoryPoints
->
stop
();
_flightTimerStop
();
_flightTimerStop
();
...
...
src/Vehicle/Vehicle.h
View file @
19522759
...
@@ -1507,7 +1507,8 @@ private:
...
@@ -1507,7 +1507,8 @@ private:
QString
_gitHash
;
QString
_gitHash
;
quint64
_uid
;
quint64
_uid
;
int
_lastAnnouncedLowBatteryPercent
;
QTime
_lastBatteryAnnouncement
;
int
_lastAnnouncedLowBatteryPercent
;
SharedLinkInterfacePointer
_priorityLink
;
// We always keep a reference to the priority link to manage shutdown ordering
SharedLinkInterfacePointer
_priorityLink
;
// We always keep a reference to the priority link to manage shutdown ordering
bool
_priorityLinkCommanded
;
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