From 452fdf6b7875f8185960f9b1649ba3d8fad4ab24 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Mon, 2 Jul 2007 20:59:26 +0000 Subject: set voltage before send diseqc command (like DiSEqC spec) --- lib/dvb/sec.cpp | 30 ++++++++++++++++++++---------- lib/dvb/sec.h | 1 + 2 files changed, 21 insertions(+), 10 deletions(-) (limited to 'lib/dvb') diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index ec2de848..f7271c18 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -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) diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index e30e3b04..31415c42 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -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: -- cgit v1.2.3