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
0fe7fa8d
Commit
0fe7fa8d
authored
Dec 22, 2013
by
Bryant Mairs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor data rate calculations in DebugConsole.
Simplify calculations by assuming we only care about rates in kB/s.
parent
56da98ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
16 deletions
+12
-16
DebugConsole.cc
src/ui/DebugConsole.cc
+9
-13
DebugConsole.h
src/ui/DebugConsole.h
+3
-3
No files found.
src/ui/DebugConsole.cc
View file @
0fe7fa8d
...
...
@@ -62,7 +62,7 @@ DebugConsole::DebugConsole(QWidget *parent) :
snapShotBytes
(
0
),
dataRate
(
0.0
f
),
lowpassDataRate
(
0.0
f
),
dataRateThreshold
(
400
),
dataRateThreshold
(
0.4
),
commandIndex
(
0
),
m_ui
(
new
Ui
::
DebugConsole
)
{
...
...
@@ -328,24 +328,20 @@ void DebugConsole::receiveTextMessage(int id, int component, int severity, QStri
void
DebugConsole
::
updateTrafficMeasurements
()
{
lowpassDataRate
=
lowpassDataRate
*
0.9
f
+
(
0.1
f
*
((
float
)
snapShotBytes
/
(
float
)
snapShotInterval
)
*
1000.0
f
);
dataRate
=
((
float
)
snapShotBytes
/
(
float
)
snapShotInterval
)
*
1000.0
f
;
// Low-pass the calculated data rate with a very low frequency digital FIR filter.
dataRate
=
(
float
)
snapShotBytes
/
(
float
)
snapShotInterval
;
lowpassDataRate
=
0.9
f
*
lowpassDataRate
+
0.1
f
*
dataRate
;
snapShotBytes
=
0
;
// Check if
limit has been exceeded
if
((
lowpassDataRate
>
dataRateThreshold
)
&&
autoHold
)
{
// Enable auto-old
// Check if
the hold rate limit has been exceeded, and if so, stop displaying the incoming data stream.
// We use the real data rate here because we want this to kick in immediately.
if
((
dataRate
>
dataRateThreshold
)
&&
autoHold
)
{
m_ui
->
holdButton
->
setChecked
(
true
);
hold
(
true
);
}
QString
speed
;
speed
=
speed
.
sprintf
(
"%04.1f kB/s"
,
dataRate
/
1000.0
f
);
m_ui
->
downSpeedLabel
->
setText
(
speed
);
if
(
holdOn
)
{
//repaint();
}
// Update the rate label.
m_ui
->
downSpeedLabel
->
setText
(
tr
(
"%L1 kB/s"
).
arg
(
lowpassDataRate
,
4
,
'f'
,
1
));
}
//QPainter painter(m_ui->receiveText);
...
...
src/ui/DebugConsole.h
View file @
0fe7fa8d
...
...
@@ -139,9 +139,9 @@ protected:
QTimer
snapShotTimer
;
///< Timer for measuring traffic snapshots
int
snapShotInterval
;
///< Snapshot interval for traffic measurements
int
snapShotBytes
;
///< Number of bytes received in current snapshot
float
dataRate
;
///< Current data rate
float
lowpassDataRate
;
///< Lowpass filtered data rate
float
dataRateThreshold
;
///< Threshold
where to enable auto-hold
float
dataRate
;
///< Current data rate
(kB/s)
float
lowpassDataRate
;
///< Lowpass filtered data rate
(kB/s)
float
dataRateThreshold
;
///< Threshold
of when to enable auto-hold (kB/s)
QStringList
commandHistory
;
QString
currCommand
;
int
commandIndex
;
...
...
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