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
85017a13
Commit
85017a13
authored
Jan 08, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix -Werror=type-limits
parent
0422b468
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
QGCXYPlot.cc
src/ui/designer/QGCXYPlot.cc
+21
-13
QGCXYPlot.h
src/ui/designer/QGCXYPlot.h
+1
-1
No files found.
src/ui/designer/QGCXYPlot.cc
View file @
85017a13
...
@@ -362,19 +362,27 @@ void QGCXYPlot::appendData(int uasId, const QString& curve, const QString& unit,
...
@@ -362,19 +362,27 @@ void QGCXYPlot::appendData(int uasId, const QString& curve, const QString& unit,
}
else
}
else
return
;
return
;
if
(
x_valid
&&
y_valid
&&
(
int
)
qAbs
(
y_timestamp_us
-
x_timestamp_us
)
<=
max_timestamp_diff_us
)
{
if
(
x_valid
&&
y_valid
)
{
int
removed
=
xycurve
->
appendData
(
QPointF
(
x
,
y
)
);
quint64
difference
;
x_valid
=
false
;
if
(
y_timestamp_us
<
x_timestamp_us
)
{
y_valid
=
false
;
difference
=
x_timestamp_us
-
y_timestamp_us
;
bool
atMaximum
=
(
ui
->
timeScrollBar
->
value
()
==
ui
->
timeScrollBar
->
maximum
());
}
else
{
if
(
ui
->
timeScrollBar
->
maximum
()
!=
xycurve
->
dataSize
())
{
difference
=
y_timestamp_us
-
x_timestamp_us
;
ui
->
timeScrollBar
->
setMaximum
(
xycurve
->
dataSize
());
}
if
(
atMaximum
)
if
(
difference
<=
max_timestamp_diff_us
)
{
ui
->
timeScrollBar
->
setValue
(
ui
->
timeScrollBar
->
maximum
());
int
removed
=
xycurve
->
appendData
(
QPointF
(
x
,
y
)
);
}
else
if
(
!
atMaximum
)
{
//Move the scrollbar to keep current value selected
x_valid
=
false
;
int
value
=
qMax
(
ui
->
timeScrollBar
->
minimum
(),
ui
->
timeScrollBar
->
value
()
-
removed
);
y_valid
=
false
;
ui
->
timeScrollBar
->
setValue
(
value
);
bool
atMaximum
=
(
ui
->
timeScrollBar
->
value
()
==
ui
->
timeScrollBar
->
maximum
());
xycurve
->
setStartIndex
(
value
);
if
(
ui
->
timeScrollBar
->
maximum
()
!=
xycurve
->
dataSize
())
{
ui
->
timeScrollBar
->
setMaximum
(
xycurve
->
dataSize
());
if
(
atMaximum
)
ui
->
timeScrollBar
->
setValue
(
ui
->
timeScrollBar
->
maximum
());
}
else
if
(
!
atMaximum
)
{
//Move the scrollbar to keep current value selected
int
value
=
qMax
(
ui
->
timeScrollBar
->
minimum
(),
ui
->
timeScrollBar
->
value
()
-
removed
);
ui
->
timeScrollBar
->
setValue
(
value
);
xycurve
->
setStartIndex
(
value
);
}
}
}
}
}
}
}
...
...
src/ui/designer/QGCXYPlot.h
View file @
85017a13
...
@@ -48,7 +48,7 @@ private:
...
@@ -48,7 +48,7 @@ private:
double
y
;
/**< Last unused value for the x-coordinate */
double
y
;
/**< Last unused value for the x-coordinate */
quint64
y_timestamp_us
;
/**< Timestamp that we last recieved a value for x */
quint64
y_timestamp_us
;
/**< Timestamp that we last recieved a value for x */
bool
y_valid
;
/**< Whether we have recieved an x value but so far no corresponding y value */
bool
y_valid
;
/**< Whether we have recieved an x value but so far no corresponding y value */
int
max_timestamp_diff_us
;
/**< Only combine x and y to a data point if the timestamp for both doesn't differ by more than this */
quint64
max_timestamp_diff_us
;
/**< Only combine x and y to a data point if the timestamp for both doesn't differ by more than this */
};
};
#endif // QGCXYPLOT_H
#endif // QGCXYPLOT_H
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