Opened 7 years ago

Last modified 3 years ago

#10845 accepted Bug Report - General

Rotor with usals not working correct after upgrade to 0.25

Reported by: cyberneticbrain@… Owned by: stuartm
Priority: minor Milestone: unknown
Component: MythTV - General Version: 0.25
Severity: medium Keywords: rotor usals
Cc: Ticket locked: no

Description (last modified by Kenni Lund [kenni a kelu dot dk])

Recently updated my mythbackend from 0.24 to 0.25. Since 0.23 I use without any problems a rotor with usals (SG2100A). Since the update the rotor is not rotating to the correct position any more. Connected my (old) receiver with it the rotor and usuals is working perfect again. Deleting the configuration in mythtv-setup and then adding a new rotor did not fix the issue. At 5a01fdade9683ddea23f60d2438fd526db788523 seems to be changed something, but I do not understand this fully. If I want the astra 28.2E now I have to put something near 26.0E so it rotates to 28.2 position. Reinstalled to 0.24 again and rotor working fine again with correct sat.settings

Change History (10)

comment:2 Changed 7 years ago by Kenni Lund [kenni a kelu dot dk]

Description: modified (diff)
Priority: majorminor

Resetting to default priority.

comment:3 Changed 7 years ago by beirdo

Status: newinfoneeded_new

Sorry, could you please repost the commit number as the URL didn't make it.

comment:5 Changed 7 years ago by cyberneticbrain@…

As a test I made a fresh install with Xubuntu 12.04 at another pc with dvb adapter and mythtv 0.25. Adding the rotor caused exactly the same problems as mentioned above. So usals not working correct any more.

comment:6 Changed 7 years ago by Kenni Lund [kenni a kelu dot dk]

Description: modified (diff)
Status: infoneeded_newnew

comment:7 Changed 6 years ago by cyberneticbrain@…

Update. Installed mythtv 0.25 from source and adapted mythtv/libs/libmythtv/diseqc.cpp before compiling.

double DiSEqCDevRotor::CalculateAzimuth(double angle) const
{
        // 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;
        double Ue = gCoreContext->GetSetting("Longitude", "").toFloat() * TO_RADS;      // Satellite Longitude in radians
        double Us = angle * TO_RADS;
        return TO_DEC * atan( tan(Us - Ue) / sin(P) );
}

changed to

double DiSEqCDevRotor::CalculateAzimuth(double angle) const
{
        // Equation lifted from VDR rotor plugin by
        // Thomas Bergwinkl <Thomas.Bergwinkl@t-online.de>
        // Earth Station Latitude and Longitude in radians
        double P  = gCoreContext->GetSetting("Latitude",  "").toFloat() * TO_RADS;
        double Ue = gCoreContext->GetSetting("Longitude", "").toFloat() * TO_RADS;
        // 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;
}

After this my rotor with usals was working again.

comment:8 Changed 4 years ago by Peter.Bienstman@…

I can confirm this: for a satellite at 28E, in Kaffeine I can use the azimuth 28 degrees without any problems, but in Mythtv, I need to put in 25.1 degrees as per the above formulas in order to go to the correct position.

comment:9 Changed 4 years ago by cyberneticbrain@…

For a while using mythtv 0.27 now and had to adapt again diseqc.cpp as above, though had to change double azimuth = atan(tmp_a / tmp_B) *TO_DEC; into double azimuth = atan(tmp_a / tmp_b) *TO_DEC; to compile and make the rotor work correctly

comment:10 Changed 4 years ago by stuartm

Owner: set to stuartm
Status: newaccepted

The problem is that we originally used that calculation but it too produced incorrect results for some.

It's possible the difference is as a result of different expectations from hardware with USALS and hardware without. I don't even understand how it's supposed to work, I don't see any code for calculating the elevation in diseqc.cpp. How does the rotor work without the elevation?

If someone could check with say, Kaffeine, to see whether it gets the correct result and what it is doing that would let us break this impasse. None of the developers have access to a rotor.

comment:11 Changed 3 years ago by peter.bienstman@…

I can confirm that using 0.28 this is still an issue. The current formulas give the wrong answers, the formulas suggested above give the same result as Kaffeine and result in a correct rotor position.

I currently work around this by inputting a 'wrong' satellite angle, which is predistorted so that Mythtv gives the correct answer.

Note: See TracTickets for help on using tickets.