{
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();
+ time_t now_time = ::time(0);
tm nowTime;
localtime_r(&now_time, &nowTime);
int now = (nowTime.tm_hour + 1) * 60 + nowTime.tm_min + 1;
#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)
+RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, const eDVBFrontendParametersSatellite &sat, int slot_id, unsigned int tunetimeout)
{
for (int idx=0; idx <= m_lnbidx; ++idx )
{
for ( int i = 0; i < loops;) // fill commands...
{
eDVBDiseqcCommand diseqc;
+ memset(diseqc.data, 0, MAX_DISEQC_LENGTH);
diseqc.len = 4;
diseqc.data[0] = i ? 0xE1 : 0xE0;
diseqc.data[1] = 0x10;
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_BETWEEN_SWITCH_AND_MOTOR_CMD]) ); // wait 700ms when diseqc changed
eDVBDiseqcCommand diseqc;
+ memset(diseqc.data, 0, MAX_DISEQC_LENGTH);
diseqc.len = 3;
diseqc.data[0] = 0xE0;
diseqc.data[1] = 0x31; // positioner
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);
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) );
if (doSetFrontend)
{
- sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT, tunetimeout) );
sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
}
frontend.setSecSequence(sec_sequence);