X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/4c1d83d373b4a0737da668945d1ddb3278b6c3b7..699d41f217b6d8e91dce499964f8c1a69f5602ed:/lib/dvb/sec.cpp diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 98b00cf9..71a1e460 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -21,8 +21,8 @@ eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl() { m_lnblist.push_back(eDVBSatelliteLNBParameters()); eDVBSatelliteLNBParameters &lnb_ref = m_lnblist.front(); + eDVBSatelliteDiseqcParameters &diseqc_ref = lnb_ref.m_diseqc_parameters; eDVBSatelliteParameters &astra1 = lnb_ref.m_satellites[192]; - eDVBSatelliteDiseqcParameters &diseqc_ref = astra1.m_diseqc_parameters; eDVBSatelliteSwitchParameters &switch_ref = astra1.m_switch_parameters; lnb_ref.m_lof_hi = 10600000; @@ -36,7 +36,7 @@ eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl() diseqc_ref.m_swap_cmds = false; diseqc_ref.m_toneburst_param = eDVBSatelliteDiseqcParameters::NO; diseqc_ref.m_uncommitted_cmd = 0; - diseqc_ref.m_use_fast = 1; + diseqc_ref.m_use_fast = 0; switch_ref.m_22khz_signal = eDVBSatelliteSwitchParameters::HILO; switch_ref.m_voltage_mode = eDVBSatelliteSwitchParameters::HV; @@ -48,11 +48,12 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA for (;it != m_lnblist.end(); ++it ) { eDVBSatelliteLNBParameters &lnb_param = *it; + eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters; std::map::iterator sit = lnb_param.m_satellites.find(sat.orbital_position); if ( sit != lnb_param.m_satellites.end()) { - eDVBSatelliteDiseqcParameters &di_param = sit->second.m_diseqc_parameters; + eDVBSatelliteSwitchParameters &sw_param = sit->second.m_switch_parameters; eDVBSatelliteRotorParameters &rotor_param = sit->second.m_rotor_parameters; int hi=0, @@ -70,8 +71,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 +128,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 +168,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 +326,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 +357,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) );