eDVBSatelliteEquipmentControl *eDVBSatelliteEquipmentControl::instance;
+int eDVBSatelliteEquipmentControl::m_params[MAX_PARAMS];
+/*
+ defaults are set in python lib/python/Components/NimManager.py
+ in InitSecParams function via setParam call
+*/
+
+void eDVBSatelliteEquipmentControl::setParam(int param, int value)
+{
+ if (param >= 0 && param < MAX_PARAMS)
+ m_params[param]=value;
+}
+
eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBRegisteredFrontend> &avail_frontends)
:m_lnbidx(-1), m_curSat(m_lnbs[0].m_satellites.end()), m_avail_frontends(avail_frontends), m_rotorMoving(false)
{
RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
RotorCmd |= 0xD000;
}
- else // west
+ else // west
{
int tmp=(int)round( fabs( 360 - satHourAngle ) * 10.0 );
RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
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) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) );
compare.voltage = iDVBFrontend::voltageOff;
- compare.steps = +4;
+ compare.steps = +3;
// the next is a check if voltage is switched off.. then we first set a voltage :)
// else we set voltage after all diseqc stuff..
sec_sequence.push_back( eSecCommand(eSecCommand::IF_NOT_VOLTAGE_GOTO, compare) );
if ( RotorCmd != -1 && RotorCmd != lastRotorCmd )
{
if (rotor_param.m_inputpower_parameters.m_use)
- compare.voltage = VOLTAGE(18); // in input power mode turn rotor always with 18V (fast)
+ compare.voltage = VOLTAGE(18); // in input power mode set 18V for measure input power
else
compare.voltage = VOLTAGE(13); // in normal mode start turning with 13V
}
else
compare.voltage = voltage;
- // voltage already correct ?
- sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
- compare.steps = +3;
sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) );
- // voltage was disabled..so we wait a longer time .. for normal switches 750ms should be enough
- sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 750) );
+
+ // voltage was disabled..so we wait a longer time .. for normal switches 250ms should be enough
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_SWITCH_CMDS]) );
for (int seq_repeat = 0; seq_repeat < (di_param.m_seq_repeat?2:1); ++seq_repeat)
{
if ( send_mask & 4 )
{
sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
- sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_TONEBURST]) );
}
int loops=0;
cmd=0x39;
else if (diseqc.data[2] == 0x39 && (send_mask & 1))
cmd=0x38;
+ int tmp = m_params[DELAY_BETWEEN_DISEQC_REPEATS];
if (cmd)
{
- int delay = di_param.m_repeats ? (120 - 54) / 2 : 120; // standard says 100msek between two repeated commands
+ int delay = di_param.m_repeats ? (tmp - 54) / 2 : tmp; // standard says 100msek between two repeated commands
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay) );
diseqc.data[2]=cmd;
diseqc.data[3]=(cmd==0x38) ? csw : ucsw;
if ( i < loops )
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay ) );
else
- sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) );
}
else // delay 120msek when no command is in repeat gap
- sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 120) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, tmp) );
}
else
- sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) );
}
if ( send_mask & 8 ) // toneburst at end of sequence
{
sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
- sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_TONEBURST]) );
}
}
}
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) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) );
compare.voltage = iDVBFrontend::voltageOff;
compare.steps = +4;
sec_sequence.push_back( eSecCommand(eSecCommand::IF_NOT_VOLTAGE_GOTO, compare) );
if (rotor_param.m_inputpower_parameters.m_use)
- sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(13)) ); // in normal mode start turning with 13V
+ sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) ); // set 18V for measure input power
else
- sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) ); // turn always with 18V
+ sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(13)) ); // in normal mode start turning with 13V
- // voltage was disabled..so we wait a longer time ..
- sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 750) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_MOTOR_CMD]) ); // wait 750ms when voltage was disabled
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, +9) ); // no need to send stop rotor cmd and recheck voltage
- }
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_BETWEEN_SWITCH_AND_MOTOR_CMD]) ); // wait 700ms when diseqc changed
eDVBDiseqcCommand diseqc;
diseqc.len = 3;
sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
- // wait 300msec after send rotor stop cmd
- sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 300) );
+ // wait 150msec after send rotor stop cmd
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_MOTOR_STOP_CMD]) );
diseqc.data[0] = 0xE0;
diseqc.data[1] = 0x31; // positioner
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::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER]) ); // wait 150msec after voltage change
sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 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::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER]) ); // wait 150msec before measure
sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 0) );
compare.val = 0;
sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) );
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, +10 ) ); // timeout .. we assume now the rotor is already at the correct position
sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -8) ); // goto loop start
////////////////////
- sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 2400) ); // 2 minutes running timeout
sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
+ 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=+3;
+ cmd.steps=+4;
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, +4 ) ); // timeout ? this should never happen
sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // running loop start
/////////////////////
+ sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
}
else
{ // use normal turning mode
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
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MOTOR_CMD]) ); // wait 150msec after voltage change
sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_ROTORPARMS) );
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::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) );
sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
cmd.direction=1; // check for running rotor
cmd.deltaA=0;
cmd.steps=+3;
cmd.okcount=0;
-
- sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 480) ); // 2 minutes running timeout
+ sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, m_params[MOTOR_RUNNING_TIMEOUT]*4) ); // 2 minutes running timeout
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 250) ); // 250msec delay
sec_sequence.push_back( eSecCommand(eSecCommand::IF_TUNER_LOCKED_GOTO, cmd ) );
sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +3 ) );
sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -3) ); // goto loop start
+ sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
}
- sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
- sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
frontend.setData(eDVBFrontend::NEW_ROTOR_CMD, RotorCmd);
frontend.setData(eDVBFrontend::NEW_ROTOR_POS, sat.orbital_position);
}
compare.steps = +3;
sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
- sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 10) );
-
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_FINAL_VOLTAGE_CHANGE]) );
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::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) );
}
if (doSetFrontend)
from config import config, ConfigSubsection, ConfigSelection, ConfigFloat, ConfigSatlist, ConfigYesNo, ConfigInteger, ConfigSubList, ConfigNothing, ConfigSubDict, ConfigOnOff
-from enigma import eDVBSatelliteEquipmentControl, \
+from enigma import eDVBSatelliteEquipmentControl as secClass, \
eDVBSatelliteLNBParameters as lnbParam, \
eDVBSatelliteDiseqcParameters as diseqcParam, \
eDVBSatelliteSwitchParameters as switchParam, \
return self.satList
def update(self):
- sec = eDVBSatelliteEquipmentControl.getInstance()
+ sec = secClass.getInstance()
sec.clear() ## this do unlinking NIMs too !!
print "sec config cleared"
self.satList = []
#print "nimDiseqcD set to " + str(val)
pass
+def InitSecParams():
+ config.sec = ConfigSubsection()
+
+ x = ConfigInteger(default=15)
+ x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_CONT_TONE, configElement.value))
+ config.sec.delay_after_continuous_tone_change = x
+
+ x = ConfigInteger(default=10)
+ x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_FINAL_VOLTAGE_CHANGE, configElement.value))
+ config.sec.delay_after_final_voltage_change = x
+
+ x = ConfigInteger(default=120)
+ x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_BETWEEN_DISEQC_REPEATS, configElement.value))
+ config.sec.delay_between_diseqc_repeats = x
+
+ x = ConfigInteger(default=50)
+ x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_LAST_DISEQC_CMD, configElement.value))
+ config.sec.delay_after_last_diseqc_command = x
+
+ x = ConfigInteger(default=50)
+ x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_TONEBURST, configElement.value))
+ config.sec.delay_after_toneburst = x
+
+ x = ConfigInteger(default=200)
+ x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_SWITCH_CMDS, configElement.value))
+ config.sec.delay_after_enable_voltage_before_switch_command = x
+
+ x = ConfigInteger(default=700)
+ x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_BETWEEN_SWITCH_AND_MOTOR_CMD, configElement.value))
+ config.sec.delay_between_switch_and_motor_command = x
+
+ x = ConfigInteger(default=150)
+ x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER, configElement.value))
+ config.sec.delay_after_voltage_change_before_measure_idle_inputpower = x
+
+ x = ConfigInteger(default=750)
+ x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_MOTOR_CMD, configElement.value))
+ config.sec.delay_after_enable_voltage_before_motor_command = x
+
+ x = ConfigInteger(default=150)
+ x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_MOTOR_STOP_CMD, configElement.value))
+ config.sec.delay_after_motor_stop_command = x
+
+ x = ConfigInteger(default=150)
+ x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MOTOR_CMD, configElement.value))
+ config.sec.delay_after_voltage_change_before_motor_command = x
+
+ x = ConfigInteger(default=120)
+ x.addNotifier(lambda configElement: secClass.setParam(secClass.MOTOR_RUNNING_TIMEOUT, configElement.value))
+ config.sec.motor_running_timeout = x
+
def InitNimManager(nimmgr):
+ InitSecParams()
+
config.Nims = ConfigSubList()
for x in range(nimmgr.nimCount):
config.Nims.append(ConfigSubsection())