zapit/src/femanager.cpp: add have_rotor flag, limit check for the same

position to frontend with configured rotor (usals or rotor positions enable).
this should allow TWIN multisat setups
This commit is contained in:
[CST] Focus
2014-03-03 14:40:30 +04:00
parent 33caf8edca
commit 06f31f9655
3 changed files with 13 additions and 24 deletions

View File

@@ -118,7 +118,6 @@ class CFEManager
CFrontend * allocateFE(CZapitChannel * channel, bool forrecord = false);
fe_mode_t getMode() { return mode; };
void setMode(fe_mode_t newmode, bool initial = false);
int getFrontendCount() { return femap.size(); };
int getEnabledCount();

View File

@@ -140,6 +140,7 @@ class CFrontend
bool slave;
fe_work_mode_t femode;
bool have_loop;
bool have_rotor;
int masterkey;
fe_linkmap_t linkmap;
int fenumber;

View File

@@ -396,9 +396,9 @@ void CFEManager::linkFrontends(bool init)
int femode = fe->getMode();
fe->slave = false;
fe->have_loop = false;
fe->have_rotor = false;
fe->linkmap.clear();
if (femode == CFrontend::FE_MODE_MASTER) {
INFO("Frontend #%d: is master", fe->fenumber);
fe->linkmap.push_back(fe);
/* fe is master, find all linked */
for(fe_map_iterator_t it2 = femap.begin(); it2 != femap.end(); it2++) {
@@ -416,6 +416,16 @@ void CFEManager::linkFrontends(bool init)
INFO("Frontend #%d: link to master %d as TWIN", fe2->fenumber, fe->fenumber);
}
}
frontend_config_t & fe_config = fe->getConfig();
satellite_map_t &satellites = fe->getSatellites();
for(sat_iterator_t sit = satellites.begin(); sit != satellites.end(); ++sit) {
if (fe_config.use_usals || (sit->second.configured && (sit->second.motor_position || sit->second.use_usals))) {
fe->have_rotor = true;
break;
}
}
INFO("Frontend #%d: is master, with loop: %s, with rotor: %s", fe->fenumber,
fe->have_loop ? "yes" : "no", fe->have_rotor ? "yes" : "no");
} else if (femode == CFrontend::FE_MODE_LINK_LOOP) {
INFO("Frontend #%d: is LOOP, master %d", fe->fenumber, fe->getMaster());
if (init)
@@ -436,27 +446,6 @@ void CFEManager::linkFrontends(bool init)
}
}
#if 0
void CFEManager::setMode(fe_mode_t newmode, bool initial)
{
if(!initial && (newmode == mode))
return;
mode = newmode;
if(femap.size() == 1)
mode = FE_MODE_SINGLE;
bool setslave = (mode == FE_MODE_LOOP) || (mode == FE_MODE_SINGLE);
for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
CFrontend * fe = it->second;
if(it != femap.begin()) {
INFO("Frontend %d as slave: %s", fe->fenumber, setslave ? "yes" : "no");
fe->setMasterSlave(setslave);
} else
fe->Init();
}
}
#endif
void CFEManager::Open()
{
for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
@@ -541,7 +530,7 @@ CFrontend * CFEManager::getFrontend(CZapitChannel * channel)
fe->Locked(), fe->getFrequency(), fe->getTsidOnid(), channel->getFreqId(), channel->getTransponderId());
if(fe->Locked()) {
if (fe->isSat() && (fe->getCurrentSatellitePosition() != satellitePosition)) {
if (mfe->have_rotor && (fe->getCurrentSatellitePosition() != satellitePosition)) {
free_frontend = NULL;
free_twin = NULL;
break;