From 1578c510eba1e58dae172b4b594cdaf263e988f0 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Sun, 1 Jan 2006 14:00:05 +0000 Subject: [PATCH] enable/disable higher lnb voltage is now working --- lib/dvb/frontend.cpp | 20 ++++++++++++++++++-- lib/dvb/idvb.h | 2 +- lib/dvb/sec.cpp | 21 +++++++++++---------- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 0cb910fb..a081a37f 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -614,7 +614,7 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer break; case eSecCommand::IF_INPUTPOWER_DELTA_GOTO: { - int idleInputpower = m_idleInputpower[m_curVoltage == iDVBFrontend::voltage13 ? 0 : 1]; + int idleInputpower = m_idleInputpower[ (m_curVoltage&1) ? 0 : 1]; eSecCommand::rotor &cmd = m_sec_sequence.current()->measure; const char *txt = cmd.direction ? "running" : "stopped"; eDebug("[SEC] waiting for rotor %s %d, idle %d, delta %d", @@ -965,9 +965,9 @@ RESULT eDVBFrontend::setVoltage(int voltage) #if HAVE_DVB_API_VERSION < 3 secVoltage vlt; #else + bool increased=false; fe_sec_voltage_t vlt; #endif - m_curVoltage=voltage; switch (voltage) { @@ -976,9 +976,23 @@ RESULT eDVBFrontend::setVoltage(int voltage) m_data[i]=-1; vlt = SEC_VOLTAGE_OFF; break; + case voltage13_5: +#if HAVE_DVB_API_VERSION < 3 + vlt = SEC_VOLTAGE_13_5; + break; +#else + increased = true; +#endif case voltage13: vlt = SEC_VOLTAGE_13; break; + case voltage18_5: +#if HAVE_DVB_API_VERSION < 3 + vlt = SEC_VOLTAGE_18_5; + break; +#else + increased = true; +#endif case voltage18: vlt = SEC_VOLTAGE_18; break; @@ -988,6 +1002,8 @@ RESULT eDVBFrontend::setVoltage(int voltage) #if HAVE_DVB_API_VERSION < 3 return ::ioctl(m_secfd, SEC_SET_VOLTAGE, vlt); #else + if (::ioctl(m_fd, FE_ENABLE_HIGH_LNB_VOLTAGE, increased) < 0) + perror("FE_ENABLE_HIGH_LNB_VOLTAGE"); return ::ioctl(m_fd, FE_SET_VOLTAGE, vlt); #endif } diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index c1c0377f..399abaa5 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -343,7 +343,7 @@ public: }; virtual RESULT setTone(int tone)=0; enum { - voltageOff, voltage13, voltage18 + voltageOff, voltage13, voltage18, voltage13_5, voltage18_5 }; virtual RESULT setVoltage(int voltage)=0; virtual RESULT sendDiseqc(const eDVBDiseqcCommand &diseqc)=0; diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 459e0c4f..0c1d79ab 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -194,6 +194,8 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite return ret; } +#define VOLTAGE(x) (lnb_param.m_increased_voltage ? iDVBFrontend::voltage##x##_5 : iDVBFrontend::voltage##x) + RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat, int frontend_id) { bool linked=false; @@ -297,12 +299,11 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_14V || ( sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Vertical && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV ) ) - voltage = iDVBFrontend::voltage13; + voltage = VOLTAGE(13); else if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_18V || ( sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV ) ) - voltage = iDVBFrontend::voltage18; - + voltage = VOLTAGE(18); if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::ON) || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && (band&1) ) ) tone = iDVBFrontend::toneOn; @@ -525,7 +526,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA if ( send_mask ) { // override first voltage change - *(++(++sec_sequence.begin()))=eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13); + *(++(++sec_sequence.begin()))=eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(13)); // wait 1 second after first switch diseqc command sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 1000) ); } @@ -537,7 +538,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA compare.voltage = voltage; compare.steps = +3; sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ? - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(13)) ); sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change } @@ -565,10 +566,10 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA sec_sequence.push_back( eSecCommand(eSecCommand::IF_IDLE_INPUTPOWER_AVAIL_GOTO, +8) ); // already measured? sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec after voltage change sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 0) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) ); sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 100) ); // wait 100msec before measure sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 1) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); // back to lower voltage + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(13)) ); // back to lower voltage sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec //////////////////////////// sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) ); @@ -583,12 +584,11 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA cmd.steps=+3; cmd.okcount=0; 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, +10 ) ); // timeout .. we assume now the rotor is already at the correct position + sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +9 ) ); // 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::SET_TIMEOUT, 2400) ); // 2 minutes running timeout - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) ); // rotor running loop sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) ); @@ -599,6 +599,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // running loop start ///////////////////// sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) ); if ( linked ) { frontend.setData(5, RotorCmd); -- 2.30.2