Skip to content

Commit

Permalink
DiSEqC: Calculate Azimuth for Rotors in line with online references.
Browse files Browse the repository at this point in the history
It appears that we lifted a bit too much from another available Azimuth calculation, which threw off our rotor positioning.

I've checked numerous online sources which indicate that this should be the correct calculation for Azimuth.

Fixes #8459, "meat" of the patch by Pieter Hoekstra.  Thanks.
  • Loading branch information
Robert McNamara committed Jun 14, 2011
1 parent 43000bc commit 5a01fda
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions mythtv/libs/libmythtv/diseqc.cpp
Expand Up @@ -2010,8 +2010,9 @@ bool DiSEqCDevRotor::ExecuteUSALS(const DiSEqCDevSettings&, const DTVMultiplex&,

double DiSEqCDevRotor::CalculateAzimuth(double angle) const
{
// Equation lifted from VDR rotor plugin by
// Thomas Bergwinkl <Thomas.Bergwinkl@t-online.de>
// Azimuth Calculation references:
// http://engr.nmsu.edu/~etti/3_2/3_2e.html
// http://www.angelfire.com/trek/ismail/theory.html

// Earth Station Latitude and Longitude in radians
double P = gCoreContext->GetSetting("Latitude", "").toFloat() * TO_RADS;
Expand All @@ -2020,14 +2021,7 @@ double DiSEqCDevRotor::CalculateAzimuth(double angle) const
// Satellite Longitude in radians
double Us = angle * TO_RADS;

double az = M_PI + atan( tan(Us - Ue) / sin(P) );
double x = acos( cos(Us - Ue) *cos(P) );
double el = atan( (cos(x) - 0.1513) / sin(x) );
double tmp_a = -cos(el) *sin(az);
double tmp_b = (sin(el) *cos(P)) - (cos(el) *sin(P) *cos(az));
double azimuth = atan(tmp_a / tmp_b) *TO_DEC;

return azimuth;
return TO_DEC * atan( tan(Us - Ue) / sin(P) );
}

double DiSEqCDevRotor::GetApproxAzimuth(void) const
Expand Down

0 comments on commit 5a01fda

Please sign in to comment.