+ if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
+ {
+ csw = 0xF0 | (csw << 2);
+ if (hi)
+ csw |= 1;
+ if (sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal)
+ csw |= 2;
+ }
+
+ bool send_csw =
+ (di_param.m_committed_cmd != eDVBSatelliteDiseqcParameters::SENDNO);
+ bool changed_csw = send_csw && csw != lastcsw;
+
+ bool send_ucsw =
+ (di_param.m_uncommitted_cmd && di_param.m_diseqc_mode > eDVBSatelliteDiseqcParameters::V1_0);
+ bool changed_ucsw = send_ucsw && ucsw != lastucsw;
+
+ bool send_burst =
+ (di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO);
+ bool changed_burst = send_burst && toneburst != lastToneburst;
+
+ bool send_diseqc = changed_ucsw;
+ if (!send_diseqc)
+ send_diseqc = changed_burst && (send_ucsw || send_csw);
+ if (!send_diseqc)
+ {
+ send_diseqc = changed_csw;
+ if ( send_diseqc && di_param.m_use_fast && (csw & 0xF0) && (lastcsw & 0xF0) && ((csw / 4) == (lastcsw / 4)) )
+ send_diseqc = false;
+ }
+
+ if ( send_diseqc || changed_burst )
+ {
+ sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 30) ); // standard says 15 msek here
+ }
+
+ if ( send_diseqc )
+ {
+ int loops=0;
+
+ if ( send_csw )
+ ++loops;
+ if ( send_ucsw )
+ ++loops;
+
+ for ( int i=0; i < di_param.m_repeats; ++i )
+ loops *= 2;
+
+ for ( int i = 0; i < loops;) // fill commands...
+ {
+ eDVBDiseqcCommand diseqc;
+ diseqc.len = 4;
+ diseqc.data[0] = i ? 0xE1 : 0xE0;
+ diseqc.data[1] = 0x10;
+
+ if ( !send_csw || (di_param.m_swap_cmds && send_ucsw) )
+ {
+ diseqc.data[2] = 0x39;
+ diseqc.data[3] = ucsw;
+ }
+ else
+ {
+ diseqc.data[2] = 0x38;
+ diseqc.data[3] = csw;
+ }
+ sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
+
+ i++;
+ if ( i < loops )
+ {
+ int cmd=0;
+ if (diseqc.data[2] == 0x38 && send_ucsw)
+ cmd=0x39;
+ else if (diseqc.data[2] == 0x39 && send_csw)
+ cmd=0x38;
+ if (cmd)
+ {
+ static int delay = (120 - 54) / 2; // 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::SEND_DISEQC, diseqc) );
+ ++i;
+ if ( i < loops )
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay ) );
+ else
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 30) );
+ }
+ else // delay 120msek when no command is in repeat gap
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 120) );
+ }
+ else
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 30) );
+ }
+ }
+ if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 && curRotorPos != sat.orbital_position )
+ {
+ }
+ if ( (changed_burst || send_diseqc) && di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO )
+ {
+ sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 30) );
+ }