- make gpixmap flags public
[enigma2.git] / lib / dvb / sec.cpp
index 98b00cf95875c3adf3bba5b549111bd848d01430..be022a169da5fef1ee3baa477a90dba118ac2ce8 100644 (file)
@@ -70,8 +70,8 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                        frontend.getData(0, lastcsw);
                        frontend.getData(1, lastucsw);
                        frontend.getData(2, lastToneburst);
-                       frontend.getData(3, lastRotorCmd);
-                       frontend.getData(4, curRotorPos);
+                       frontend.getData(5, lastRotorCmd);
+                       frontend.getData(6, curRotorPos);
 
                        if ( sat.frequency > lnb_param.m_lof_threshold )
                                hi = 1;
@@ -127,6 +127,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                tone = iDVBFrontend::toneOff;
 
                        eSecCommandList sec_sequence;
+                       bool setVoltage=true;
 
                        if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
                        {
@@ -166,6 +167,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                        sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
                                        sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
                                        sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 30) );  // standard says 15 msek here
+                                       setVoltage=false;
                                }
 
                                if ( send_diseqc )
@@ -323,8 +325,29 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                }
                                                if ( rotor_param.m_inputpower_parameters.m_use )
                                                { // use measure rotor input power to detect rotor state
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18) ); // always turn with high voltage
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );  // wait 50sec after voltage change
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER) );
                                                        sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 8) );  // 2 seconds rotor start timout
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 250) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
+                                                       eSecCommand::rotor cmd;
+                                                       cmd.direction=1;  // check for running rotor
+                                                       cmd.deltaA=rotor_param.m_inputpower_parameters.m_threshold;
+                                                       cmd.steps=+3;
+                                                       cmd.okcount=0;
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +8 ) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 240) );  // 1 minute running timeout
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 250) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
+                                                       cmd.direction=0;  // check for stopped rotor
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +2 ) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) );
+                                                       sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
                                                        frontend.setData(3, RotorCmd);
                                                        frontend.setData(4, sat.orbital_position);
                                                }
@@ -333,7 +356,8 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                        }
                                }
                        }
-                       else
+
+                       if ( setVoltage )
                        {
                                sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
                                sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 10) );