From: Andreas Monzner Date: Mon, 30 May 2005 10:25:26 +0000 (+0000) Subject: rotor turning with measure input power is now working X-Git-Tag: 2.6.0~5819 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/94284f21b07f1756120e8b6f5dd53e485a9ff66d?ds=sidebyside rotor turning with measure input power is now working --- diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 8a8e591f..54c545ee 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -414,7 +414,7 @@ bool eDVBFrontend::setSecSequencePos(int steps) { if (m_sec_sequence.current() != m_sec_sequence.begin() && m_sec_sequence.current() != m_sec_sequence.end()) --m_sec_sequence.current(); - --steps; + ++steps; } return true; } @@ -428,19 +428,19 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer { case eSecCommand::SLEEP: delay = m_sec_sequence.current()++->msec; - eDebug("sleep %dms\n", delay); + eDebug("sleep %dms", delay); break; case eSecCommand::GOTO: if ( !setSecSequencePos(m_sec_sequence.current()->steps) ) ++m_sec_sequence.current(); break; case eSecCommand::SET_VOLTAGE: - setVoltage(m_sec_sequence.current()++->voltage); eDebug("setVoltage %d", m_sec_sequence.current()->voltage); + setVoltage(m_sec_sequence.current()++->voltage); break; case eSecCommand::SET_TONE: - setTone(m_sec_sequence.current()++->tone); eDebug("setTone %d", m_sec_sequence.current()->tone); + setTone(m_sec_sequence.current()++->tone); break; case eSecCommand::SEND_DISEQC: sendDiseqc(m_sec_sequence.current()->diseqc); @@ -451,8 +451,8 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer ++m_sec_sequence.current(); break; case eSecCommand::SEND_TONEBURST: - sendToneburst(m_sec_sequence.current()++->toneburst); eDebug("sendToneburst: %d", m_sec_sequence.current()->toneburst); + sendToneburst(m_sec_sequence.current()++->toneburst); break; case eSecCommand::SET_FRONTEND: eDebug("setFrontend"); @@ -476,7 +476,7 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer case eSecCommand::UPDATE_CURRENT_ROTORPARAMS: m_data[5] = m_data[3]; m_data[6] = m_data[4]; - eDebug("update current rotorparams %d", m_timeoutCount); + eDebug("update current rotorparams %d %04x %d", m_timeoutCount, m_data[5], m_data[6]); ++m_sec_sequence.current(); break; case eSecCommand::IF_TIMEOUT_GOTO: @@ -485,8 +485,37 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer else ++m_sec_sequence.current(); break; - case eSecCommand::IF_RUNNING_GOTO: - case eSecCommand::IF_STOPPED_GOTO: + case eSecCommand::IF_INPUTPOWER_DELTA_GOTO: + { + eSecCommand::rotor &cmd = m_sec_sequence.current()->measure; + const char *txt = cmd.direction ? "running" : "stopped"; + eDebug("waiting for rotor %s", txt); + eDebug("%s %d, idle %d, delta %d", + txt, + m_runningInputpower, + m_idleInputpower, + cmd.deltaA); + if ( (cmd.direction && abs(m_runningInputpower - m_idleInputpower) >= cmd.deltaA) + || (!cmd.direction && abs(m_runningInputpower - m_idleInputpower) <= cmd.deltaA) ) + { + ++cmd.okcount; + eDebug("rotor %s step %d ok", txt, cmd.okcount); + if ( cmd.okcount > 1 ) + { + eDebug("rotor is %s", txt); + if (setSecSequencePos(cmd.steps)) + break; + } + } + else + { + eDebug("rotor not %s... reset counter.. increase timeout", txt); + --m_timeoutCount; + cmd.okcount=0; + } + ++m_sec_sequence.current(); + break; + } default: ++m_sec_sequence.current(); eDebug("unhandled sec command"); @@ -805,7 +834,7 @@ RESULT eDVBFrontend::setSecSequence(const eSecCommandList &list) RESULT eDVBFrontend::getData(int num, int &data) { - if ( num < 5 ) + if ( num < 7 ) { data = m_data[num]; return 0; @@ -815,7 +844,7 @@ RESULT eDVBFrontend::getData(int num, int &data) RESULT eDVBFrontend::setData(int num, int val) { - if ( num < 5 ) + if ( num < 7 ) { m_data[num] = val; return 0; diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 041d1fbc..be022a16 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -332,13 +332,19 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA 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) ); - sec_sequence.push_back( eSecCommand(eSecCommand::IF_RUNNING_GOTO, +3 ) ); + 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) ); - sec_sequence.push_back( eSecCommand(eSecCommand::IF_STOPPED_GOTO, +3 ) ); + 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) ); diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index 71fff6a5..2e279900 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -11,11 +11,18 @@ public: enum { NONE, SLEEP, SET_VOLTAGE, SET_TONE, GOTO, SEND_DISEQC, SEND_TONEBURST, SET_FRONTEND, - MEASURE_IDLE_INPUTPOWER, MEASURE_RUNNING_INPUTPOWER, - IF_TIMEOUT_GOTO, IF_RUNNING_GOTO, IF_STOPPED_GOTO, - UPDATE_CURRENT_ROTORPARAMS, SET_TIMEOUT, + MEASURE_IDLE_INPUTPOWER, MEASURE_RUNNING_INPUTPOWER, + IF_TIMEOUT_GOTO, IF_INPUTPOWER_DELTA_GOTO, + UPDATE_CURRENT_ROTORPARAMS, SET_TIMEOUT }; int cmd; + struct rotor + { + int deltaA; // difference in mA between running and stopped rotor + int okcount; // counter + int steps; // goto steps + int direction; + }; union { int val; @@ -25,6 +32,7 @@ public: int tone; int toneburst; int msec; + rotor measure; eDVBDiseqcCommand diseqc; }; eSecCommand( int cmd ) @@ -36,6 +44,9 @@ public: eSecCommand( int cmd, eDVBDiseqcCommand diseqc ) :cmd(cmd), diseqc(diseqc) {} + eSecCommand( int cmd, rotor measure ) + :cmd(cmd), measure(measure) + {} eSecCommand() :cmd(NONE) {} @@ -145,7 +156,16 @@ public: std::map< int, int, Orbital_Position_Compare > m_rotor_position_table; /* mapping orbitalposition <-> number stored in rotor */ - void setDefaultOptions(); // set default rotor options + void setDefaultOptions() // set default rotor options + { + m_inputpower_parameters.m_use = true; + m_inputpower_parameters.m_threshold = 60; + m_gotoxx_parameters.m_can_use = true; + m_gotoxx_parameters.m_lo_direction = EAST; + m_gotoxx_parameters.m_la_direction = NORTH; + m_gotoxx_parameters.m_longitude = 0.0; + m_gotoxx_parameters.m_latitude = 0.0; + } }; class eDVBSatelliteParameters