setRotorPosNum(1); // stored pos 1
}
-int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite &sat, iDVBFrontend *fe, int slot_id )
+int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite &sat, iDVBFrontend *fe, int slot_id, int *highest_score_lnb)
{
- int ret=0, satcount=0;
+ int score=0, satcount=0;
+
+ if (highest_score_lnb)
+ *highest_score_lnb = -1;
for (int idx=0; idx <= m_lnbidx; ++idx )
{
eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
if ( lnb_param.slot_mask & slot_id ) // lnb for correct tuner?
{
+ int ret = 0;
eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
satcount += lnb_param.m_satellites.size();
if (tuner_freq < 900000 || tuner_freq > 2200000)
ret=0;
}
+ if (ret > score)
+ {
+ score = ret;
+ if (highest_score_lnb)
+ *highest_score_lnb = idx;
+ }
}
}
}
- if (ret && satcount)
- ret -= (satcount-1);
- if (ret && m_not_linked_slot_mask & slot_id)
- ret += 5; // increase score for tuners with direct sat connection
- return ret;
+ if (score && satcount)
+ score -= (satcount-1);
+ if (score && m_not_linked_slot_mask & slot_id)
+ score += 5; // increase score for tuners with direct sat connection
+ return score;
}
bool need_turn_fast(int turn_speed)
RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, const eDVBFrontendParametersSatellite &sat, int slot_id, unsigned int tunetimeout)
{
- for (int idx=0; idx <= m_lnbidx; ++idx )
+ int lnb_idx = -1;
+ if (canTune(sat, &frontend, slot_id, &lnb_idx))
{
- eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
- if (!(lnb_param.slot_mask & slot_id)) // lnb for correct tuner?
- continue;
+ eDVBSatelliteLNBParameters &lnb_param = m_lnbs[lnb_idx];
eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
eDVBSatelliteRotorParameters &rotor_param = lnb_param.m_rotor_parameters;
bool doSetFrontend = true;
bool doSetVoltageToneFrontend = true;
bool allowDiseqc1_2 = true;
+ bool sendDiSEqC = false;
long band=0,
voltage = iDVBFrontend::voltageOff,
tone = iDVBFrontend::toneOff,
// check if voltage is disabled
compare.voltage = iDVBFrontend::voltageOff;
- compare.steps = +5;
+ compare.steps = +4;
sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
- sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_SWITCHPARMS) );
// 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::SET_VOLTAGE, vlt) );
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_SWITCH_CMDS]) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_SWITCHPARMS) );
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::SLEEP, m_params[DELAY_AFTER_TONEBURST]) );
}
}
+ sendDiSEqC = true;
}
eDebug("RotorCmd %02x, lastRotorCmd %02lx", RotorCmd, lastRotorCmd);
compare.val = 0;
sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) );
////////////////////////////
- sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_DISEQC_RETRYS, m_params[MOTOR_COMMAND_RETRIES]) ); // 2 retries
sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_ROTORPARMS) );
sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // running 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::SET_ROTOR_STOPPED) );
}
else
sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) );
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_ROTOR_MOVING) );
sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
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::SET_ROTOR_STOPPED) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +3) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) );
}
sec_fe->setData(eDVBFrontend::NEW_ROTOR_CMD, RotorCmd);
sec_fe->setData(eDVBFrontend::NEW_ROTOR_POS, sat.orbital_position);
+ sendDiSEqC = true;
}
}
}
csw = band;
}
+ if (sendDiSEqC)
+ sec_sequence.push_front( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
+
sec_fe->setData(eDVBFrontend::NEW_CSW, csw);
sec_fe->setData(eDVBFrontend::NEW_UCSW, ucsw);
sec_fe->setData(eDVBFrontend::NEW_TONEBURST, di_param.m_toneburst_param);
sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT, tunetimeout) );
sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
}
+
+ if (sendDiSEqC)
+ sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
+
frontend.setSecSequence(sec_sequence);
return 0;
}
}
+ else
+ eFatal("canTune failed in sec prepare!!! this should never ever happen!");
eDebug("found no useable satellite configuration for orbital position (%d)", sat.orbital_position );
return -1;