aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-12-05 15:30:41 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-12-05 15:30:41 +0000
commitd28a04695ff2ac8931c89c0d08a4cc7931916dd8 (patch)
tree8bad081dc32065af62875978fae169078865f8e3
parent763193df158ff0432fb67b37589f910b93c84c17 (diff)
downloadenigma2-d28a04695ff2ac8931c89c0d08a4cc7931916dd8.tar.gz
enigma2-d28a04695ff2ac8931c89c0d08a4cc7931916dd8.zip
small optimize
-rw-r--r--lib/dvb/frontend.cpp28
-rw-r--r--lib/dvb/frontend.h3
-rw-r--r--lib/dvb/sec.cpp22
-rw-r--r--lib/dvb/sec.h8
4 files changed, 46 insertions, 15 deletions
diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp
index c4d64122..d8be8494 100644
--- a/lib/dvb/frontend.cpp
+++ b/lib/dvb/frontend.cpp
@@ -1147,7 +1147,7 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer
case eSecCommand::IF_VOLTAGE_GOTO:
{
eSecCommand::pair &compare = m_sec_sequence.current()->compare;
- if ( compare.voltage == m_curVoltage && setSecSequencePos(compare.steps) )
+ if ( compare.voltage == m_data[CUR_VOLTAGE] && setSecSequencePos(compare.steps) )
break;
++m_sec_sequence.current();
break;
@@ -1155,7 +1155,23 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer
case eSecCommand::IF_NOT_VOLTAGE_GOTO:
{
eSecCommand::pair &compare = m_sec_sequence.current()->compare;
- if ( compare.voltage != m_curVoltage && setSecSequencePos(compare.steps) )
+ if ( compare.voltage != m_data[CUR_VOLTAGE] && setSecSequencePos(compare.steps) )
+ break;
+ ++m_sec_sequence.current();
+ break;
+ }
+ case eSecCommand::IF_TONE_GOTO:
+ {
+ eSecCommand::pair &compare = m_sec_sequence.current()->compare;
+ if ( compare.tone == m_data[CUR_TONE] && setSecSequencePos(compare.steps) )
+ break;
+ ++m_sec_sequence.current();
+ break;
+ }
+ case eSecCommand::IF_NOT_TONE_GOTO:
+ {
+ eSecCommand::pair &compare = m_sec_sequence.current()->compare;
+ if ( compare.tone != m_data[CUR_TONE] && setSecSequencePos(compare.steps) )
break;
++m_sec_sequence.current();
break;
@@ -1214,7 +1230,7 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer
case eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO:
{
eSecCommand::pair &compare = m_sec_sequence.current()->compare;
- int idx = compare.voltage;
+ int idx = compare.val;
if ( idx == 0 || idx == 1 )
{
int idle = readInputpower();
@@ -1261,7 +1277,7 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer
break;
case eSecCommand::IF_INPUTPOWER_DELTA_GOTO:
{
- int idleInputpower = m_idleInputpower[ (m_curVoltage&1) ? 0 : 1];
+ int idleInputpower = m_idleInputpower[ (m_data[CUR_VOLTAGE]&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",
@@ -1834,7 +1850,7 @@ RESULT eDVBFrontend::setVoltage(int voltage)
bool increased=false;
fe_sec_voltage_t vlt;
#endif
- m_curVoltage=voltage;
+ m_data[CUR_VOLTAGE]=voltage;
switch (voltage)
{
case voltageOff:
@@ -1889,7 +1905,7 @@ RESULT eDVBFrontend::setTone(int t)
#else
fe_sec_tone_mode_t tone;
#endif
-
+ m_data[CUR_TONE]=t;
switch (t)
{
case toneOn:
diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h
index 78011276..df028c19 100644
--- a/lib/dvb/frontend.h
+++ b/lib/dvb/frontend.h
@@ -70,6 +70,8 @@ class eDVBFrontend: public iDVBFrontend, public Object
LINKED_NEXT_PTR, // next double linked list (for linked FEs)
SATPOS_DEPENDS_PTR, // pointer to FE with configured rotor (with twin/quattro lnb)
FREQ_OFFSET, // current frequency offset
+ CUR_VOLTAGE, // current voltage
+ CUR_TONE, // current continuous tone
NUM_DATA_ENTRIES
};
@@ -80,7 +82,6 @@ class eDVBFrontend: public iDVBFrontend, public Object
int m_timeoutCount; // needed for timeout
int m_retryCount; // diseqc retry for rotor
- int m_curVoltage;
void feEvent(int);
void timeout();
diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp
index faad062f..8d65e413 100644
--- a/lib/dvb/sec.cpp
+++ b/lib/dvb/sec.cpp
@@ -523,9 +523,12 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
if ( send_mask )
{
+ eSecCommand::pair compare;
+ compare.steps = +3;
+ compare.tone = iDVBFrontend::toneOff;
+ sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) );
sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) );
- eSecCommand::pair compare;
compare.voltage = iDVBFrontend::voltageOff;
compare.steps = +4;
// the next is a check if voltage is switched off.. then we first set a voltage :)
@@ -643,12 +646,12 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
// voltage was disabled..so we wait a longer time ..
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 750) );
- sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +8) ); // no need to send stop rotor cmd and recheck voltage
+ sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +9) ); // no need to send stop rotor cmd and recheck voltage
}
else
{
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 750) ); // wait 750ms after send switch cmd
- sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +8) ); // no need to send stop rotor cmd and recheck voltage
+ sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +9) ); // no need to send stop rotor cmd and recheck voltage
}
eDVBDiseqcCommand diseqc;
@@ -685,19 +688,19 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
eSecCommand::rotor cmd;
eSecCommand::pair compare;
compare.voltage = VOLTAGE(18);
- compare.steps = +2;
+ compare.steps = +3;
sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) );
// measure idle power values
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 200) ); // wait 200msec after voltage change
sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 1) );
- compare.voltage = 1;
+ compare.val = 1;
compare.steps = -2;
sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) );
sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(13)) );
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 200) ); // wait 200msec before measure
sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 0) );
- compare.voltage = 0;
+ compare.val = 0;
sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) );
////////////////////////////
sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
@@ -737,7 +740,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
eSecCommand::rotor cmd;
eSecCommand::pair compare;
compare.voltage = VOLTAGE(13);
- compare.steps = +2;
+ compare.steps = +3;
sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) );
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 200) ); // wait 200msec after voltage change
@@ -752,7 +755,10 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 2000) ); // wait 2 second before set high voltage
sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
+ compare.tone = tone;
+ sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) );
sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) );
sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
cmd.direction=1; // check for running rotor
@@ -788,6 +794,8 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 10) );
+ compare.tone = tone;
+ sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) );
sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) );
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) );
}
diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h
index 701797a4..499e3737 100644
--- a/lib/dvb/sec.h
+++ b/lib/dvb/sec.h
@@ -21,6 +21,7 @@ public:
UPDATE_CURRENT_ROTORPARAMS, INVALIDATE_CURRENT_ROTORPARMS,
IF_ROTORPOS_VALID_GOTO,
IF_TUNER_LOCKED_GOTO,
+ IF_TONE_GOTO, IF_NOT_TONE_GOTO,
START_TUNE_TIMEOUT
};
int cmd;
@@ -33,7 +34,12 @@ public:
};
struct pair
{
- int voltage;
+ union
+ {
+ int voltage;
+ int tone;
+ int val;
+ };
int steps;
};
union