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
437053dd
Commit
437053dd
authored
Mar 04, 2015
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:mavlink/qgroundcontrol
parents
f00c9608
fd1272ea
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
3 deletions
+61
-3
QGCAudioWorker.cpp
src/audio/QGCAudioWorker.cpp
+41
-2
QGCAudioWorker.h
src/audio/QGCAudioWorker.h
+3
-0
MockQGCUASParamManager.cc
src/qgcunittest/MockQGCUASParamManager.cc
+11
-0
MockQGCUASParamManager.h
src/qgcunittest/MockQGCUASParamManager.h
+1
-1
PX4RCCalibration.cc
src/ui/px4_configuration/PX4RCCalibration.cc
+5
-0
No files found.
src/audio/QGCAudioWorker.cpp
View file @
437053dd
...
...
@@ -2,6 +2,7 @@
#include <QDebug>
#include <QCoreApplication>
#include <QFile>
#include <QRegularExpression>
#include "QGC.h"
#include "QGCAudioWorker.h"
...
...
@@ -89,7 +90,7 @@ QGCAudioWorker::~QGCAudioWorker()
#endif
}
void
QGCAudioWorker
::
say
(
QString
t
ext
,
int
severity
)
void
QGCAudioWorker
::
say
(
QString
inT
ext
,
int
severity
)
{
static
bool
threadInit
=
false
;
if
(
!
threadInit
)
{
...
...
@@ -99,6 +100,7 @@ void QGCAudioWorker::say(QString text, int severity)
if
(
!
muted
)
{
QString
text
=
_fixMillisecondString
(
inText
);
// Prepend high priority text with alert beep
if
(
severity
<
GAudioOutput
::
AUDIO_SEVERITY_CRITICAL
)
{
beep
();
...
...
@@ -139,7 +141,7 @@ void QGCAudioWorker::say(QString text, int severity)
#else
// Make sure there isn't an unused variable warning when speech output is disabled
Q_UNUSED
(
t
ext
);
Q_UNUSED
(
inT
ext
);
#endif
}
}
...
...
@@ -170,3 +172,40 @@ bool QGCAudioWorker::isMuted()
{
return
this
->
muted
;
}
bool
QGCAudioWorker
::
_getMillisecondString
(
const
QString
&
string
,
QString
&
match
,
int
&
number
)
{
QRegularExpression
re
(
"([0-9]*ms)"
);
QRegularExpressionMatchIterator
i
=
re
.
globalMatch
(
string
);
while
(
i
.
hasNext
())
{
QRegularExpressionMatch
qmatch
=
i
.
next
();
if
(
qmatch
.
hasMatch
())
{
match
=
qmatch
.
captured
(
0
);
number
=
qmatch
.
captured
(
0
).
replace
(
"ms"
,
""
).
toInt
();
return
true
;
}
}
return
false
;
}
QString
QGCAudioWorker
::
_fixMillisecondString
(
const
QString
&
string
)
{
QString
match
;
QString
newNumber
;
QString
result
=
string
;
int
number
;
if
(
_getMillisecondString
(
string
,
match
,
number
)
&&
number
>
1000
)
{
if
(
number
<
60000
)
{
int
seconds
=
number
/
1000
;
newNumber
=
QString
(
"%1 second%2"
).
arg
(
seconds
).
arg
(
seconds
>
1
?
"s"
:
""
);
}
else
{
int
minutes
=
number
/
60000
;
int
seconds
=
(
number
-
(
minutes
*
60000
))
/
1000
;
if
(
!
seconds
)
{
newNumber
=
QString
(
"%1 minute%2"
).
arg
(
minutes
).
arg
(
minutes
>
1
?
"s"
:
""
);
}
else
{
newNumber
=
QString
(
"%1 minute%2 and %3 second%4"
).
arg
(
minutes
).
arg
(
minutes
>
1
?
"s"
:
""
).
arg
(
seconds
).
arg
(
seconds
>
1
?
"s"
:
""
);
}
}
result
.
replace
(
match
,
newNumber
);
}
return
result
;
}
src/audio/QGCAudioWorker.h
View file @
437053dd
...
...
@@ -50,6 +50,9 @@ protected:
bool
emergency
;
///< Emergency status flag
QTimer
*
emergencyTimer
;
bool
muted
;
private:
QString
_fixMillisecondString
(
const
QString
&
string
);
bool
_getMillisecondString
(
const
QString
&
string
,
QString
&
match
,
int
&
number
);
};
#endif // QGCAUDIOWORKER_H
src/qgcunittest/MockQGCUASParamManager.cc
View file @
437053dd
...
...
@@ -102,3 +102,14 @@ void MockQGCUASParamManager::_loadParams(void)
_mapParams
[
paramName
]
=
paramValue
;
}
}
QList
<
int
>
MockQGCUASParamManager
::
getComponentForParam
(
const
QString
&
parameter
)
const
{
if
(
_mapParams
.
contains
(
parameter
))
{
QList
<
int
>
list
;
list
<<
50
;
return
list
;
}
else
{
return
QList
<
int
>
();
}
}
src/qgcunittest/MockQGCUASParamManager.h
View file @
437053dd
...
...
@@ -77,7 +77,7 @@ public:
public:
// Unimplemented QGCUASParamManagerInterface overrides
virtual
QList
<
int
>
getComponentForParam
(
const
QString
&
parameter
)
const
{
Q_ASSERT
(
false
);
Q_UNUSED
(
parameter
);
return
_bogusQListInt
;
}
virtual
QList
<
int
>
getComponentForParam
(
const
QString
&
parameter
)
const
;
virtual
void
setParamDescriptions
(
const
QMap
<
QString
,
QString
>&
paramDescs
)
{
Q_ASSERT
(
false
);
Q_UNUSED
(
paramDescs
);
}
virtual
int
countPendingParams
()
{
Q_ASSERT
(
false
);
return
0
;
}
virtual
UASParameterDataModel
*
dataModel
()
{
Q_ASSERT
(
false
);
return
NULL
;
}
...
...
src/ui/px4_configuration/PX4RCCalibration.cc
View file @
437053dd
...
...
@@ -924,6 +924,11 @@ void PX4RCCalibration::_writeCalibration(void)
paramMgr
->
setPendingParam
(
0
,
_rgFunctionInfo
[
i
].
parameterName
,
paramChannel
);
}
// If the RC_CHAN_COUNT parameter is available write the channel count
if
(
paramMgr
->
getComponentForParam
(
"RC_CHAN_CNT"
).
count
()
!=
0
)
{
paramMgr
->
setPendingParam
(
0
,
"RC_CHAN_CNT"
,
_chanCount
);
}
//let the param mgr manage sending all the pending RC_foo updates and persisting after
paramMgr
->
sendPendingParameters
(
true
,
true
);
...
...
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