make some diseqc / continuous tone / toneburst / rotor values (delays,
[enigma2.git] / lib / dvb / sec.cpp
index 43d56e306c55cad242edace9d6f39d76281c4c0a..81008c7bfe6631be4b4b5815c0d2e1f8f16e9d32 100644 (file)
@@ -15,6 +15,18 @@ DEFINE_REF(eDVBSatelliteEquipmentControl);
 
 eDVBSatelliteEquipmentControl *eDVBSatelliteEquipmentControl::instance;
 
 
 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)
 {
 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)
 {
@@ -481,7 +493,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                                        RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
                                                                        RotorCmd |= 0xD000;
                                                                }
                                                                        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 ];
                                                                {
                                                                        int tmp=(int)round( fabs( 360 - satHourAngle ) * 10.0 );
                                                                        RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
@@ -500,9 +512,9 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                        compare.tone = iDVBFrontend::toneOff;
                                        sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) );
                                        sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
                                        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.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) );
                                        // 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) );
@@ -510,26 +522,24 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                        if ( RotorCmd != -1 && RotorCmd != lastRotorCmd )
                                        {
                                                if (rotor_param.m_inputpower_parameters.m_use)
                                        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;
 
                                                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) );
                                        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) );
 
                                        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;
                                                }
 
                                                int loops=0;
@@ -572,9 +582,10 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                                        cmd=0x39;
                                                                else if (diseqc.data[2] == 0x39 && (send_mask & 1))
                                                                        cmd=0x38;
                                                                        cmd=0x39;
                                                                else if (diseqc.data[2] == 0x39 && (send_mask & 1))
                                                                        cmd=0x38;
+                                                               int tmp = m_params[DELAY_BETWEEN_DISEQC_REPEATS];
                                                                if (cmd)
                                                                {
                                                                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;
                                                                        sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay) );
                                                                        diseqc.data[2]=cmd;
                                                                        diseqc.data[3]=(cmd==0x38) ? csw : ucsw;
@@ -583,19 +594,19 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                                        if ( i < loops )
                                                                                sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay ) );
                                                                        else
                                                                        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
                                                                }
                                                                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
                                                        }
                                                        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) );
                                                }
 
                                                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]) );
                                                }
                                        }
                                }
                                                }
                                        }
                                }
@@ -609,7 +620,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                compare.tone = iDVBFrontend::toneOff;
                                                sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) );
                                                sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
                                                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.voltage = iDVBFrontend::voltageOff;
                                                compare.steps = +4;
@@ -618,19 +629,15 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                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::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
                                                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::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;
 
                                        eDVBDiseqcCommand diseqc;
                                        diseqc.len = 3;
@@ -641,8 +648,8 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                        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) );
                                        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
 
                                        diseqc.data[0] = 0xE0;
                                        diseqc.data[1] = 0x31;          // positioner
@@ -670,13 +677,13 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                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::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::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::MEASURE_IDLE_INPUTPOWER, 0) );
                                                compare.val = 0;
                                                sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) );
@@ -696,20 +703,23 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                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_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::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_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
 // 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_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::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
                                        }
                                        else
                                        {  // use normal turning mode
@@ -721,7 +731,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                compare.steps = +3;
                                                sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
                                                sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) );
                                                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) );
 
                                                sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
                                                sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_ROTORPARMS) );
@@ -736,22 +746,21 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                                compare.tone = tone;
                                                sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) );
                                                sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) );
                                                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_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::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);
                                }
                                        frontend.setData(eDVBFrontend::NEW_ROTOR_CMD, RotorCmd);
                                        frontend.setData(eDVBFrontend::NEW_ROTOR_POS, sat.orbital_position);
                                }
@@ -770,12 +779,11 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
                                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) );
                                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) );
                                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)
                        }
 
                        if (doSetFrontend)