Commit 8dc38948 authored by Giuseppe Carboni's avatar Giuseppe Carboni Committed by GitHub
Browse files

Fix #469, improved XBackend initialization and setup phase (#470)

parent ad66aa12
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -584,6 +584,7 @@ private:
	double m_tpiZero[MAX_INPUT_NUMBER];
	double m_tpiZero[MAX_INPUT_NUMBER];


	bool initializeConfiguration(const IRA::CString & config);
	bool initializeConfiguration(const IRA::CString & config);
	bool setupConfiguration(const IRA::CString & config);
	
	
	/**
	/**
	 * Check if the connection is still up and ready. If a previuos call timed out it will check the status of the connection.
	 * Check if the connection is still up and ready. If a previuos call timed out it will check the status of the connection.
+26 −17
Original line number Original line Diff line number Diff line
@@ -610,8 +610,16 @@ void CCommandLine::setup(const char *conf) throw (BackendsErrors::BackendBusyExI
		_EXCPT(BackendsErrors::ConfigurationErrorExImpl,impl,"CCommandLine::setup()");
		_EXCPT(BackendsErrors::ConfigurationErrorExImpl,impl,"CCommandLine::setup()");
		throw impl;
		throw impl;
	}
	}
	//setDefaultConfiguration(); //could throw exceptions........

	//ACS_LOG(LM_FULL_INFO,"CCommandLine::initializeConfiguration()",(LM_NOTICE,"BACKEND_INITIALIZED: %s",conf)); 
    IRA::CIRATools::Wait(1,0);
	setDefaultConfiguration(); //could throw exceptions........

    IRA::CIRATools::Wait(1,0);
    if (!setupConfiguration(conf)) {
		_EXCPT(BackendsErrors::ConfigurationErrorExImpl,impl,"CCommandLine::setup()");
		throw impl;
	}	
	ACS_LOG(LM_FULL_INFO,"CCommandLine::initializeConfiguration()",(LM_NOTICE,"BACKEND_INITIALIZED: %s",conf)); 
}
}




@@ -1215,7 +1223,7 @@ long CCommandLine::searchFeed(long ChIn)


bool CCommandLine::initializeConfiguration(const IRA::CString & config) 
bool CCommandLine::initializeConfiguration(const IRA::CString & config) 
{
{
    if (start == true) {
    //if (start == true) {
	long i=0;
	long i=0;
	for( i=0;i<MAX_INPUT_NUMBER;i++) {
	for( i=0;i<MAX_INPUT_NUMBER;i++) {
		m_attenuation[i]=gainToAttenuation(DEFAULT_GAIN);//DEFAULT_ATTENUATION;
		m_attenuation[i]=gainToAttenuation(DEFAULT_GAIN);//DEFAULT_ATTENUATION;
@@ -1269,9 +1277,6 @@ bool CCommandLine::initializeConfiguration(const IRA::CString & config)
	for( i=0;i<m_beams*2;i++) m_ChIn[i]=(long)(i/2);//{0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,-1,-1};//Mapping Feed to ChIn
	for( i=0;i<m_beams*2;i++) m_ChIn[i]=(long)(i/2);//{0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,-1,-1};//Mapping Feed to ChIn
	for( i=(m_beams)*2;i<(MAX_ADC_NUMBER);i++) m_ChIn[i]=-1;//-1 non è connesso
	for( i=(m_beams)*2;i<(MAX_ADC_NUMBER);i++) m_ChIn[i]=-1;//-1 non è connesso


        


	//if (DEFAULT_MODE8BIT)
	//if (DEFAULT_MODE8BIT)
	//	m_mode8bit=true;
	//	m_mode8bit=true;
	if (m_mode8bit==true){
	if (m_mode8bit==true){
@@ -1391,21 +1396,25 @@ AUTO_TRACE("CCommandLine::setMode8bit()");
		if(j==MAX_ADC_NUMBER) j=0;
		if(j==MAX_ADC_NUMBER) j=0;
		else j++;
		else j++;
	}
	}
    start=false;
//    start=false;
//    }
    return true;
}
}
    else {

bool CCommandLine::setupConfiguration (const IRA::CString & config)
{
    m_XarcosC=false;
    m_XarcosC=false;
	    m_XarcosK00 = false;
	    m_XarcosK00 = false;
	    m_XarcosK77 = false;
	    m_XarcosK77 = false;
	    m_XarcosK03 = false;
	    m_XarcosK03 = false;
	    m_XarcosK06 = false;
	    m_XarcosK06 = false;
	    m_XarcosK01 = false;
	    m_XarcosK01 = false;
        start = true;
        //start = true;
        IRA::CIRATools::Wait(1,0);
        //IRA::CIRATools::Wait(1,0);
		setup("NNNN");
		//setup("NNNN");
        setDefaultConfiguration();
        //setDefaultConfiguration();
        start = false;
        //start = false;
        IRA::CIRATools::Wait(2,0);
        //IRA::CIRATools::Wait(2,0);
    //printf("initialize configuration end\n");
    //printf("initialize configuration end\n");
	//IRA::CIRATools::Wait(2,0);
	//IRA::CIRATools::Wait(2,0);
    if (config=="XK77") { //in order to add a new configuration add an other if
    if (config=="XK77") { //in order to add a new configuration add an other if
@@ -1528,7 +1537,7 @@ AUTO_TRACE("CCommandLine::setMode8bit()");
    }
    }
    else
    else
        return false;
        return false;
    }
    //}
	//ACS_LOG(LM_FULL_INFO,"CCommandLine::initializeConfiguration()",(LM_NOTICE,"BACKEND_INITIALIZED: %s",config)); 
	//ACS_LOG(LM_FULL_INFO,"CCommandLine::initializeConfiguration()",(LM_NOTICE,"BACKEND_INITIALIZED: %s",config)); 
	return true;
	return true;
}
}