Commit a4d8fef6 authored by Carlo Migoni's avatar Carlo Migoni
Browse files

avoid segmentation fault setProfile if AS is not up

parent 16012f42
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -231,6 +231,8 @@ private:
	bool m_sector1, m_sector2, m_sector3, m_sector4, m_sector5, m_sector6, m_sector7, m_sector8;

	bool m_profileSetted;
	
	bool m_ASup;
};

#endif /*SRTACTIVESURFACEBOSSCORE_H_*/
+23 −16
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ void CSRTActiveSurfaceBossCore::initialize()
    
    	m_enable = false;
	m_tracking = false;
    	m_status = Management::MNG_OK;
    	m_status = Management::MNG_WARNING;
	m_profile = ActiveSurface::AS_SHAPED_FIXED;
    	AutoUpdate = false;
    	actuatorcounter = circlecounter = totacts = 1;
@@ -33,6 +33,7 @@ void CSRTActiveSurfaceBossCore::initialize()
	m_sector7 = false;
	m_sector8 = false;
	m_profileSetted = false;
	m_ASup = false;
}

void CSRTActiveSurfaceBossCore::execute() throw (ComponentErrors::CouldntGetComponentExImpl)
@@ -1722,13 +1723,18 @@ void CSRTActiveSurfaceBossCore::setProfile(const ActiveSurface::TASProfile& newP
		m_sector7 = false;
		m_sector8 = false;
		usdCounter = usdCounterS1 + usdCounterS2 + usdCounterS3 + usdCounterS4 + usdCounterS5 + usdCounterS6 + usdCounterS7 + usdCounterS8;
		if (usdCounter < (int)lastUSD*WARNINGUSDPERCENT)
		if (usdCounter < (int)lastUSD*WARNINGUSDPERCENT) {
        		m_status=Management::MNG_WARNING;
    		if (usdCounter < (int)lastUSD*ERRORUSDPERCENT)
			m_ASup=true;
		}
    		if (usdCounter < (int)lastUSD*ERRORUSDPERCENT) {
        		m_status=Management::MNG_FAILURE;
			m_ASup=false;
		}
		//printf("usdCounter = %d\n", usdCounter);
	}	

	if (m_ASup == true) {
		CIRATools::Wait(1000000);
		_SET_CDB_CORE(profile, newProfile,"SRTActiveSurfaceBossCore::setProfile")
		m_profile = newProfile;
@@ -1745,6 +1751,7 @@ void CSRTActiveSurfaceBossCore::setProfile(const ActiveSurface::TASProfile& newP
        	CIRATools::Wait(1000000);
		asOn();
	}
}

void CSRTActiveSurfaceBossCore::asSetup() throw (ComponentErrors::ComponentErrorsEx)
{