mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
OP-82 : Small bug correction where the heading scale could become offset if the heading jumped back and forth just around 180 degrees. Should be fixed now.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@876 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
d404b93fea
commit
ee2e21e7e1
@ -309,13 +309,10 @@ void PFDGadgetWidget::resizeEvent(QResizeEvent *event)
|
||||
}
|
||||
|
||||
|
||||
// Take an input value and rotate the dial accordingly
|
||||
// Rotation is smooth, starts fast and slows down when
|
||||
// Take an input value and move the elements accordingly.
|
||||
// Movement is smooth, starts fast and slows down when
|
||||
// approaching the target.
|
||||
// We aim for a 0.5 degree precision.
|
||||
//
|
||||
// Note: this code is valid even if needle1 and needle2 point
|
||||
// to the same element.
|
||||
void PFDGadgetWidget::rotateNeedles()
|
||||
{
|
||||
int dialCount = 3;
|
||||
@ -359,11 +356,12 @@ void PFDGadgetWidget::rotateNeedles()
|
||||
dialCount--;
|
||||
}
|
||||
double threshold = -180*compassBandWidth/540;
|
||||
// The below does not work 100% perfect yet, visually speaking...
|
||||
if ((headingValue < threshold) && ((headingValue+headingDiff)>threshold)) {
|
||||
// Note: rendering can jump oh so very slightly when crossing the 180 degree
|
||||
// boundary, should not impact actual useability of the display.
|
||||
if ((headingValue < threshold) && ((headingValue+headingDiff)>=threshold)) {
|
||||
// We went over 180°: activate a -360 degree offset
|
||||
headingOffset = 2*threshold;
|
||||
} else if ((headingValue > threshold) && ((headingValue+headingDiff)<threshold)) {
|
||||
} else if ((headingValue >= threshold) && ((headingValue+headingDiff)<threshold)) {
|
||||
// We went under 180°: remove the -360 degree offset
|
||||
headingOffset = -2*threshold;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user