fix tune failed problems on fast zap
[enigma2.git] / lib / dvb / sec.cpp
index 3d8084c84d2f0d3a0bf8624fa326393560bc421b..3c6834c7d952b4d5677f88cdebf10f1ec6e02bd6 100644 (file)
@@ -12,7 +12,7 @@
 #endif
 #include <lib/base/eerror.h>
 
-//#define SEC_DEBUG
+#define SEC_DEBUG
 
 #ifdef SEC_DEBUG
 #define eSecDebug(arg...) eDebug(arg)
@@ -544,9 +544,8 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
 
                                                // check if voltage is disabled
                                                compare.voltage = iDVBFrontend::voltageOff;
-                                               compare.steps = +5;
+                                               compare.steps = +4;
                                                sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
-                                               sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_SWITCHPARMS) );
 
                                                // voltage is changed... use DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS
                                                sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, vlt) );
@@ -557,6 +556,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, vlt) );
                                                sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_SWITCH_CMDS]) );
 
+                                               sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_SWITCHPARMS) );
                                                for (int seq_repeat = 0; seq_repeat < (di_param.m_seq_repeat?2:1); ++seq_repeat)
                                                {
                                                        if ( send_mask & 4 )
@@ -730,9 +730,10 @@ 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, turn_fast ? 9 : 8 ) );  // 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 ? 10 : 9 ) );  // timeout .. we assume now the rotor is already at the correct position 
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -8) );  // goto loop start
 ////////////////////
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_MOVING) );
                                                        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
@@ -747,6 +748,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
 /////////////////////
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_STOPPED) );
                                                }
                                                else
                                                {  // use normal turning mode
@@ -762,6 +764,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
 
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_ROTORPARMS) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_MOVING) );
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
 
                                                        compare.voltage = voltage;
@@ -787,6 +790,10 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -3) );  // goto loop start
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_STOPPED) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +3) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -5) );
                                                }
                                                sec_fe->setData(eDVBFrontend::NEW_ROTOR_CMD, RotorCmd);
                                                sec_fe->setData(eDVBFrontend::NEW_ROTOR_POS, sat.orbital_position);