}
case iDVBFrontend::feCable:
hash = 0xFFFF0000;
+ hash |= (cable.frequency/1000)&0xFFFF;
return 0;
case iDVBFrontend::feTerrestrial:
hash = 0xEEEE0000;
+ hash |= (terrestrial.frequency/1000)&0xFFFF;
+ return 0;
+ default:
+ return -1;
+ }
+}
+
+RESULT eDVBFrontendParameters::calcLockTimeout(unsigned int &timeout) const
+{
+ switch (m_type)
+ {
+ case iDVBFrontend::feSatellite:
+ {
+ /* high symbol rate transponders tune faster, due to
+ requiring less zigzag and giving more symbols faster.
+
+ 5s are definitely not enough on really low SR when
+ zigzag has to find the exact frequency first.
+ */
+ if (sat.symbol_rate > 20000000)
+ timeout = 5000;
+ else if (sat.symbol_rate > 10000000)
+ timeout = 10000;
+ else
+ timeout = 20000;
+ return 0;
+ }
+ case iDVBFrontend::feCable:
+ timeout = 5000;
+ return 0;
+ case iDVBFrontend::feTerrestrial:
+ timeout = 5000;
return 0;
default:
return -1;
m_dvbid, linked_fe->m_frontend->getDVBID(), linked_fe->m_frontend->getSlotID());
return -1;
}
- linked_fe->m_frontend->getData(LINKED_NEXT_PTR, (int&)linked_fe);
+ linked_fe->m_frontend->getData(LINKED_NEXT_PTR, (long&)linked_fe);
}
if (m_fd >= 0)
{
void fillDictWithSatelliteData(ePyObject dict, const FRONTENDPARAMETERS &parm, eDVBFrontend *fe)
{
- int freq_offset=0;
- int csw=0;
+ long freq_offset=0;
+ long csw=0;
const char *tmp=0;
fe->getData(eDVBFrontend::CSW, csw);
fe->getData(eDVBFrontend::FREQ_OFFSET, freq_offset);
else
{
eDVBRegisteredFrontend *next = (eDVBRegisteredFrontend *)m_data[LINKED_NEXT_PTR];
- while ( (int)next != -1 )
+ while ( (long)next != -1 )
{
next->m_frontend->m_data[ROTOR_CMD] = cmd;
next->m_frontend->m_data[ROTOR_POS] = pos;
next = (eDVBRegisteredFrontend *)next->m_frontend->m_data[LINKED_NEXT_PTR];
}
eDVBRegisteredFrontend *prev = (eDVBRegisteredFrontend *)m_data[LINKED_PREV_PTR];
- while ( (int)prev != -1 )
+ while ( (long)prev != -1 )
{
prev->m_frontend->m_data[ROTOR_CMD] = cmd;
prev->m_frontend->m_data[ROTOR_POS] = pos;
++m_sec_sequence.current();
break;
case eSecCommand::START_TUNE_TIMEOUT:
- m_timeout->start(5000, 1); // 5 sec timeout. TODO: symbolrate dependent
+ {
+ m_timeout->start(m_sec_sequence.current()->timeout, 1);
++m_sec_sequence.current();
break;
+ }
case eSecCommand::SET_TIMEOUT:
m_timeoutCount = m_sec_sequence.current()++->val;
eDebug("[SEC] set timeout %d", m_timeoutCount);
break;
case eSecCommand::UPDATE_CURRENT_ROTORPARAMS:
setRotorData(m_data[NEW_ROTOR_POS], m_data[NEW_ROTOR_CMD]);
- eDebug("[SEC] update current rotorparams %d %04x %d", m_timeoutCount, m_data[ROTOR_CMD], m_data[ROTOR_POS]);
+ eDebug("[SEC] update current rotorparams %d %04lx %ld", m_timeoutCount, m_data[ROTOR_CMD], m_data[ROTOR_POS]);
++m_sec_sequence.current();
break;
case eSecCommand::SET_ROTOR_DISEQC_RETRYS:
return 0;
}
-RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm)
+RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm, unsigned int tunetimeout)
{
int res;
if (!m_sec)
eWarning("no SEC module active!");
return -ENOENT;
}
- res = m_sec->prepare(*this, parm, feparm, 1 << m_slotid);
+ res = m_sec->prepare(*this, parm, feparm, 1 << m_slotid, tunetimeout);
if (!res)
{
eDebug("prepare_sat System %d Freq %d Pol %d SR %d INV %d FEC %d orbpos %d",
RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
{
+ unsigned int timeout = 5000;
eDebug("(%d)tune", m_dvbid);
m_timeout->stop();
m_sn->stop();
m_sec_sequence.clear();
+ where.calcLockTimeout(timeout);
+
switch (m_type)
{
case feSatellite:
goto tune_error;
}
m_sec->setRotorMoving(false);
- res=prepare_sat(feparm);
+ res=prepare_sat(feparm, timeout);
if (res)
goto tune_error;
if (res)
goto tune_error;
- m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) );
+ m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT, timeout) );
m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
break;
}
std::string enable_5V;
char configStr[255];
snprintf(configStr, 255, "config.Nims.%d.terrestrial_5V", m_slotid);
- m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) );
+ m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT, timeout) );
ePythonConfigQuery::getConfigValue(configStr, enable_5V);
if (enable_5V == "True")
m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) );
return 0;
}
-RESULT eDVBFrontend::getData(int num, int &data)
+RESULT eDVBFrontend::getData(int num, long &data)
{
if ( num < NUM_DATA_ENTRIES )
{
return -EINVAL;
}
-RESULT eDVBFrontend::setData(int num, int val)
+RESULT eDVBFrontend::setData(int num, long val)
{
if ( num < NUM_DATA_ENTRIES )
{