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
a41fb7cf
Commit
a41fb7cf
authored
Sep 06, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix UT only shutdown ordering crash
parent
d14444a5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
33 deletions
+23
-33
GAudioOutput.cc
src/GAudioOutput.cc
+1
-20
GAudioOutput.h
src/GAudioOutput.h
+1
-5
UAS.cc
src/uas/UAS.cc
+18
-8
UAS.h
src/uas/UAS.h
+3
-0
No files found.
src/GAudioOutput.cc
View file @
a41fb7cf
...
...
@@ -55,7 +55,6 @@ GAudioOutput::GAudioOutput(QObject *parent) :
worker
->
moveToThread
(
thread
);
connect
(
this
,
&
GAudioOutput
::
textToSpeak
,
worker
,
&
QGCAudioWorker
::
say
);
connect
(
this
,
&
GAudioOutput
::
beepOnce
,
worker
,
&
QGCAudioWorker
::
beep
);
connect
(
thread
,
&
QThread
::
finished
,
thread
,
&
QObject
::
deleteLater
);
connect
(
thread
,
&
QThread
::
finished
,
worker
,
&
QObject
::
deleteLater
);
thread
->
start
();
...
...
@@ -82,28 +81,10 @@ bool GAudioOutput::isMuted()
return
muted
;
}
bool
GAudioOutput
::
say
(
QString
text
,
int
severity
)
bool
GAudioOutput
::
say
(
const
QString
&
text
,
int
severity
)
{
if
(
!
muted
)
{
emit
textToSpeak
(
text
,
severity
);
}
return
true
;
}
/**
* @param text This message will be played after the alert beep
*/
bool
GAudioOutput
::
alert
(
QString
text
)
{
if
(
!
muted
)
{
emit
textToSpeak
(
text
,
1
);
}
return
true
;
}
void
GAudioOutput
::
beep
()
{
if
(
!
muted
)
{
emit
beepOnce
();
}
}
src/GAudioOutput.h
View file @
a41fb7cf
...
...
@@ -77,11 +77,7 @@ public:
public
slots
:
/** @brief Say this text if current output priority matches */
bool
say
(
QString
text
,
int
severity
=
6
);
/** @brief Play alert sound and say notification message */
bool
alert
(
QString
text
);
/** @brief Play emergency sound once */
void
beep
();
bool
say
(
const
QString
&
text
,
int
severity
=
6
);
/** @brief Mute/unmute sound */
void
mute
(
bool
mute
);
...
...
src/uas/UAS.cc
View file @
a41fb7cf
...
...
@@ -348,7 +348,7 @@ void UAS::updateState()
connectionLost
=
true
;
receivedMode
=
false
;
QString
audiostring
=
QString
(
"Link lost to system %1"
).
arg
(
this
->
getUASID
());
GAudioOutput
::
instance
()
->
say
(
audiostring
.
toLower
(),
GAudioOutput
::
AUDIO_SEVERITY_ALERT
);
_
say
(
audiostring
.
toLower
(),
GAudioOutput
::
AUDIO_SEVERITY_ALERT
);
}
// Update connection loss time on each iteration
...
...
@@ -362,7 +362,7 @@ void UAS::updateState()
if
(
connectionLost
&&
(
heartbeatInterval
<
timeoutIntervalHeartbeat
))
{
QString
audiostring
=
QString
(
"Link regained to system %1"
).
arg
(
this
->
getUASID
());
GAudioOutput
::
instance
()
->
say
(
audiostring
.
toLower
(),
GAudioOutput
::
AUDIO_SEVERITY_NOTICE
);
_
say
(
audiostring
.
toLower
(),
GAudioOutput
::
AUDIO_SEVERITY_NOTICE
);
connectionLost
=
false
;
connectionLossTime
=
0
;
emit
heartbeatTimeout
(
false
,
0
);
...
...
@@ -553,12 +553,12 @@ void UAS::receiveMessage(mavlink_message_t message)
if
(
statechanged
&&
((
int
)
state
.
system_status
==
(
int
)
MAV_STATE_CRITICAL
||
state
.
system_status
==
(
int
)
MAV_STATE_EMERGENCY
))
{
GAudioOutput
::
instance
()
->
say
(
QString
(
"Emergency for system %1"
).
arg
(
this
->
getUASID
()),
GAudioOutput
::
AUDIO_SEVERITY_EMERGENCY
);
_
say
(
QString
(
"Emergency for system %1"
).
arg
(
this
->
getUASID
()),
GAudioOutput
::
AUDIO_SEVERITY_EMERGENCY
);
QTimer
::
singleShot
(
3000
,
GAudioOutput
::
instance
(),
SLOT
(
startEmergency
()));
}
else
if
(
modechanged
||
statechanged
)
{
GAudioOutput
::
instance
()
->
say
(
audiostring
.
toLower
());
_
say
(
audiostring
.
toLower
());
}
}
...
...
@@ -621,7 +621,7 @@ void UAS::receiveMessage(mavlink_message_t message)
/* warn only every 12 seconds */
&&
(
QGC
::
groundTimeUsecs
()
-
lastVoltageWarning
)
>
12000000
)
{
GAudioOutput
::
instance
()
->
say
(
QString
(
"Voltage warning for system %1: %2 volts"
).
arg
(
getUASID
()).
arg
(
lpVoltage
,
0
,
'f'
,
1
,
QChar
(
' '
)));
_
say
(
QString
(
"Voltage warning for system %1: %2 volts"
).
arg
(
getUASID
()).
arg
(
lpVoltage
,
0
,
'f'
,
1
,
QChar
(
' '
)));
lastVoltageWarning
=
QGC
::
groundTimeUsecs
();
lastTickVoltageValue
=
tickLowpassVoltage
;
}
...
...
@@ -1198,7 +1198,7 @@ void UAS::receiveMessage(mavlink_message_t message)
mavlink_msg_mission_item_reached_decode
(
&
message
,
&
wpr
);
waypointManager
.
handleWaypointReached
(
message
.
sysid
,
message
.
compid
,
&
wpr
);
QString
text
=
QString
(
"System %1 reached waypoint %2"
).
arg
(
getUASID
()).
arg
(
wpr
.
seq
);
GAudioOutput
::
instance
()
->
say
(
text
);
_
say
(
text
);
emit
textMessageReceived
(
message
.
sysid
,
message
.
compid
,
MAV_SEVERITY_INFO
,
text
);
}
break
;
...
...
@@ -1247,7 +1247,7 @@ void UAS::receiveMessage(mavlink_message_t message)
{
text
.
remove
(
"#"
);
emit
textMessageReceived
(
uasId
,
message
.
compid
,
severity
,
text
);
GAudioOutput
::
instance
()
->
say
(
text
.
toLower
(),
severity
);
_
say
(
text
.
toLower
(),
severity
);
}
else
{
...
...
@@ -3393,7 +3393,7 @@ void UAS::startLowBattAlarm()
{
if
(
!
lowBattAlarm
)
{
GAudioOutput
::
instance
()
->
alert
(
tr
(
"System %1 has low battery"
).
arg
(
getUASID
()));
_say
(
tr
(
"System %1 has low battery"
).
arg
(
getUASID
()));
lowBattAlarm
=
true
;
}
}
...
...
@@ -3465,3 +3465,13 @@ void UAS::unsetRCToParameterMap()
_vehicle
->
sendMessage
(
message
);
}
}
void
UAS
::
_say
(
const
QString
&
text
,
int
severity
)
{
#ifndef UNITTEST_BUILD
GAudioOutput
::
instance
()
->
say
(
text
,
severity
);
#else
Q_UNUSED
(
text
)
Q_UNUSED
(
severity
)
#endif
}
src/uas/UAS.h
View file @
a41fb7cf
...
...
@@ -981,6 +981,9 @@ protected slots:
/** @brief Read settings from disk */
void
readSettings
();
private:
void
_say
(
const
QString
&
text
,
int
severity
=
6
);
private:
Vehicle
*
_vehicle
;
};
...
...
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