X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/145e4cd8d0cd2e7a24e9ca5971c128902f7da4e1..4eac43bf1c66847feef1711990e4c67043f90d79:/lib/dvb/sec.cpp diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 7f45f576..ff3f9bd0 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include @@ -253,6 +254,30 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite return ret; } +bool need_turn_fast(int turn_speed) +{ + if (turn_speed == eDVBSatelliteRotorParameters::FAST) + return true; + else if (turn_speed != eDVBSatelliteRotorParameters::SLOW) + { + int begin = turn_speed >> 16; // high word is start time + int end = turn_speed&0xFFFF; // low word is end time + time_t now_time = eDVBLocalTimeHandler::getInstance()->nowTime(); + tm nowTime; + localtime_r(&now_time, &nowTime); + int now = (nowTime.tm_hour + 1) * 60 + nowTime.tm_min + 1; + bool neg = end <= begin; + if (neg) { + int tmp = begin; + begin = end; + end = tmp; + } + if ((now >= begin && now < end) ^ neg) + return true; + } + return false; +} + #define VOLTAGE(x) (lnb_param.m_increased_voltage ? iDVBFrontend::voltage##x##_5 : iDVBFrontend::voltage##x) RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, const eDVBFrontendParametersSatellite &sat, int slot_id) @@ -678,7 +703,8 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA 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::GOTO, -8) ); // goto loop start //////////////////// - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) ); + if (need_turn_fast(rotor_param.m_inputpower_parameters.m_turning_speed)) + 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 @@ -1072,6 +1098,16 @@ RESULT eDVBSatelliteEquipmentControl::setRotorPosNum(int rotor_pos_num) return 0; } +RESULT eDVBSatelliteEquipmentControl::setRotorTurningSpeed(int speed) +{ + eSecDebug("eDVBSatelliteEquipmentControl::setRotorTurningSpeed(%d)", speed); + if ( currentLNBValid() ) + m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_turning_speed = speed; + else + return -ENOENT; + return 0; +} + struct sat_compare { int orb_pos, lofl, lofh;