set voltage before send diseqc command (like DiSEqC spec)
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 2 Jul 2007 20:59:26 +0000 (20:59 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 2 Jul 2007 20:59:26 +0000 (20:59 +0000)
lib/dvb/sec.cpp
lib/dvb/sec.h
lib/python/Components/NimManager.py
lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py

index ec2de848a73996aa1b75bce55269280fb85e6a23..f7271c1878db54466c9b8c3c1906c2ff7c655d2a 100644 (file)
@@ -460,31 +460,41 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
 
                                        if ( send_mask )
                                        {
+                                               int vlt = iDVBFrontend::voltageOff;
                                                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, m_params[DELAY_AFTER_CONT_TONE]) );
-                                               compare.voltage = iDVBFrontend::voltageOff;
-                                               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 set 18V for measure input power
+                                                               vlt = VOLTAGE(18);  // in input power mode set 18V for measure input power
                                                        else
-                                                               compare.voltage = VOLTAGE(13);  // in normal mode start turning with 13V
+                                                               vlt = VOLTAGE(13);  // in normal mode start turning with 13V
                                                }
                                                else
-                                                       compare.voltage = voltage;
+                                                       vlt = voltage;
+
+                                               // check if voltage is already correct..
+                                               compare.voltage = vlt;
+                                               compare.steps = +7;
+                                               sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
+
+                                               // check if voltage is disabled
+                                               compare.voltage = iDVBFrontend::voltageOff;
+                                               compare.steps = +4;
+                                               sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
 
-                                               sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) );
+                                               // voltage is changed... use DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS
+                                               sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, vlt) );
+                                               sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS]) );
+                                               sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +3) );
 
-                                                       // voltage was disabled..so we wait a longer time .. for normal switches 250ms should be enough
+                                               // voltage was disabled.. use DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_SWITCH_CMDS
+                                               sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, vlt) );
                                                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)
index e30e3b0442e29635beda4c741e7ab81302b570d5..31415c4254923dd89ffc477b344f336b3c9093f6 100644 (file)
@@ -255,6 +255,7 @@ public:
                DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MOTOR_CMD, // delay after voltage change before transmit motor command
                MOTOR_COMMAND_RETRIES, // max transmit tries of rotor command when the rotor dont start turning (with power measurement)
                MOTOR_RUNNING_TIMEOUT, // max motor running time before timeout
+               DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS, // delay after change voltage before transmit toneburst/diseqc
                MAX_PARAMS
        };
 private:
index d69f7b8f8d90dd0bab6b3d7eebf8e776f153a99c..d1b90c6230162083d2b95e12ef49ffadaeb8c31d 100644 (file)
@@ -730,6 +730,10 @@ def InitSecParams():
        x.addNotifier(lambda configElement: secClass.setParam(secClass.MOTOR_COMMAND_RETRIES, configElement.value))
        config.sec.motor_command_retries = x
 
+       x = ConfigInteger(default=20, limits = (0, 9999))
+       x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS, configElement.value))
+       config.sec.delay_after_change_voltage_before_switch_command = x
+
 # TODO add support for satpos depending nims to advanced nim configuration
 # so a second/third/fourth cable from a motorized lnb can used behind a
 # diseqc 1.0 / diseqc 1.1 / toneburst switch
index bb7459200fefa7e1705e8f1664593dbe8f50ea5a..b9d3e4445bd47f2133834e882c24941e77ed2972 100644 (file)
@@ -28,6 +28,7 @@ class SecParameterSetup(Screen, ConfigListScreen):
                        ("Delay between diseqc commands", config.sec.delay_between_diseqc_repeats),
                        ("Delay after last diseqc command", config.sec.delay_after_last_diseqc_command),
                        ("Delay after toneburst", config.sec.delay_after_toneburst),
+                       ("Delay after change voltage before switch command", config.sec.delay_after_change_voltage_before_switch_command),
                        ("Delay after enable voltage before switch command", config.sec.delay_after_enable_voltage_before_switch_command),
                        ("Delay between switch and motor command", config.sec.delay_between_switch_and_motor_command),
                        ("Delay after set voltage before measure motor power", config.sec.delay_after_voltage_change_before_measure_idle_inputpower),