fix linking tuners
[enigma2.git] / lib / dvb / sec.cpp
index 9270a619ad7f45aeeccbe0e9aac13fa92a0f4730..5c0601adb111fc8e4c8ac6f7556cb41cae64aade 100644 (file)
@@ -669,6 +669,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
 
                                                if ( rotor_param.m_inputpower_parameters.m_use )
                                                { // use measure rotor input power to detect rotor state
+                                                       bool turn_fast = need_turn_fast(rotor_param.m_inputpower_parameters.m_turning_speed);
                                                        eSecCommand::rotor cmd;
                                                        eSecCommand::pair compare;
                                                        compare.voltage = VOLTAGE(18);
@@ -702,19 +703,19 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) );  // check if rotor has started
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +2 ) );  // timeout .. we assume now the rotor is already at the correct position
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) );  // goto loop start
-                                                       sec_sequence.push_back( eSecCommand(eSecCommand::IF_NO_MORE_ROTOR_DISEQC_RETRYS_GOTO, +9 ) );  // timeout .. we assume now the rotor is already at the correct position
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::IF_NO_MORE_ROTOR_DISEQC_RETRYS_GOTO, turn_fast ? 9 : 8 ) );  // timeout .. we assume now the rotor is already at the correct position  
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -8) );  // goto loop start
 ////////////////////
-                                                       if (need_turn_fast(rotor_param.m_inputpower_parameters.m_turning_speed))
+                                                       if (turn_fast)
                                                                sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) );
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, m_params[MOTOR_RUNNING_TIMEOUT]*20) );  // 2 minutes running timeout
 // rotor running loop
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );  // wait 50msec
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
                                                        cmd.direction=0;  // check for stopped rotor
-                                                       cmd.steps=+4;
+                                                       cmd.steps=+3;
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) );
-                                                       sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +3 ) );  // timeout ? this should never happen
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +2 ) );  // timeout ? this should never happen
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) );  // running loop start
 /////////////////////
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
@@ -848,7 +849,7 @@ RESULT eDVBSatelliteEquipmentControl::addLNB()
                eDebug("no more LNB free... cnt is %d", m_lnbidx);
                return -ENOSPC;
        }
-       eSecDebug("eDVBSatelliteEquipmentControl::addLNB(%d)", m_lnbidx-1);
+       eSecDebug("eDVBSatelliteEquipmentControl::addLNB(%d)", m_lnbidx);
        return 0;
 }
 
@@ -1259,12 +1260,11 @@ RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2)
        {
                eDVBRegisteredFrontend *p1=NULL, *p2=NULL;
 
-               int cnt=0;
-               for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it, ++cnt)
+               for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
                {
-                       if (cnt == tu1)
+                       if (it->m_frontend->getSlotID() == tu1)
                                p1 = *it;
-                       else if (cnt == tu2)
+                       else if (it->m_frontend->getSlotID() == tu2)
                                p2 = *it;
                }
                if (p1 && p2)
@@ -1296,12 +1296,11 @@ RESULT eDVBSatelliteEquipmentControl::setTunerDepends(int tu1, int tu2)
 
        eDVBRegisteredFrontend *p1=NULL, *p2=NULL;
 
-       int cnt=0;
-       for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it, ++cnt)
+       for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
        {
-               if (cnt == tu1)
+               if (it->m_frontend->getSlotID() == tu1)
                        p1 = *it;
-               else if (cnt == tu2)
+               else if (it->m_frontend->getSlotID() == tu2)
                        p2 = *it;
        }
        if (p1 && p2)