Unverified Commit 2994a1a4 authored by Andrea Orlati's avatar Andrea Orlati Committed by GitHub
Browse files

fix issue #777: the problem is easily repetible, I found out some coding...

fix issue #777: the problem is easily repetible, I found out some coding issues that could cause problems but not sure this will solve (#799)
parent 2a63fcff
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -570,6 +570,7 @@ void CMedicinaMountSocket::Stop() throw (TimeoutExImpl,AntennaErrors::NakExImpl,
{
{
	if (isBusy()) setStopped(true);
	if (isBusy()) setStopped(true);
	Mode(CACUInterface::STOP,CACUInterface::STOP,true);
	Mode(CACUInterface::STOP,CACUInterface::STOP,true);
	CUSTOM_LOG(LM_FULL_INFO,"CMedicinaMountSocket::stop()",(LM_NOTICE,"ANTENNA_STOPPED"));
}
}


void CMedicinaMountSocket::Mode(CACUInterface::TAxeModes azMode,CACUInterface::TAxeModes elMode,bool force) 
void CMedicinaMountSocket::Mode(CACUInterface::TAxeModes azMode,CACUInterface::TAxeModes elMode,bool force) 
@@ -855,6 +856,7 @@ void CMedicinaMountSocket::checkPowerFailure() throw (ComponentErrors::TimeoutEx
{
{
	//_IRA_LOGDIKE_COMPLETION(m_logDike,__dummy,LM_DEBUG);
	//_IRA_LOGDIKE_COMPLETION(m_logDike,__dummy,LM_DEBUG);
	if (!m_configuration->checkForMode()) return;
	if (!m_configuration->checkForMode()) return;
	if (getStatus()!=Antenna::ACU_CNTD) return;
	TIMEVALUE now;
	TIMEVALUE now;
	IRA::CIRATools::getTime(now);
	IRA::CIRATools::getTime(now);
	if (m_Data.getDrivePower()) {  //in case of a power outage of failure.....
	if (m_Data.getDrivePower()) {  //in case of a power outage of failure.....
@@ -883,6 +885,7 @@ void CMedicinaMountSocket::checkCommandedMode() throw (ConnectionExImpl,SocketEr
{
{
	CACUInterface::TAxeModes commandedMode, mode;
	CACUInterface::TAxeModes commandedMode, mode;
	if (!m_configuration->checkForMode()) return;
	if (!m_configuration->checkForMode()) return;
	if (getStatus()!=Antenna::ACU_CNTD) return;
	if (m_powerFailTime!=0) return; // no need to try to recover from mode discrepancy if the cause is a power failure
	if (m_powerFailTime!=0) return; // no need to try to recover from mode discrepancy if the cause is a power failure
	commandedMode=m_Data.getLastCommandedMode();
	commandedMode=m_Data.getLastCommandedMode();
	if ((commandedMode!=CACUInterface::STANDBY)  && (commandedMode!=CACUInterface::UNSTOW) &&
	if ((commandedMode!=CACUInterface::STANDBY)  && (commandedMode!=CACUInterface::UNSTOW) &&
@@ -911,6 +914,7 @@ void CMedicinaMountSocket::detectOscillation() throw (ConnectionExImpl,SocketErr
	TIMEVALUE now;
	TIMEVALUE now;
	// if oscillation is not to be checked then exit immediately 
	// if oscillation is not to be checked then exit immediately 
	if (!m_configuration->checkForOscillation()) return;
	if (!m_configuration->checkForOscillation()) return;
	if (getStatus()!=Antenna::ACU_CNTD) return;
	double azError=getAzimuthError(); // throw (ConnectionExImpl,SocketErrorExImpl,TimeoutExImpl)
	double azError=getAzimuthError(); // throw (ConnectionExImpl,SocketErrorExImpl,TimeoutExImpl)
	IRA::CIRATools::getTime(now);
	IRA::CIRATools::getTime(now);
	CACUInterface::TAxeModes mode=m_Data.getLastCommandedMode();
	CACUInterface::TAxeModes mode=m_Data.getLastCommandedMode();
+11 −4
Original line number Original line Diff line number Diff line
@@ -49,10 +49,7 @@ void CMedicinaMountControlThread::runLoop()
	currentJobID=currentJob->jobID;
	currentJobID=currentJob->jobID;
	currentJob.Release(); // this is important in order to avoid possible deadlock.
	currentJob.Release(); // this is important in order to avoid possible deadlock.
	CSecAreaResourceWrapper<CMedicinaMountSocket> socket=m_pACUControl->Get();
	CSecAreaResourceWrapper<CMedicinaMountSocket> socket=m_pACUControl->Get();
	socket->updateComponent();  // before commenting out or deleting consider that inside this method the flushing of pending event of the log dike object is called

	socket->detectOscillation();
	socket->checkPowerFailure();
	socket->checkCommandedMode();
	if (currentJobID!=0) {
	if (currentJobID!=0) {
		ACSErr::Completion_var comp;
		ACSErr::Completion_var comp;
		if (socket->updateLongJobs(currentJobID,comp.out())) {
		if (socket->updateLongJobs(currentJobID,comp.out())) {
@@ -66,4 +63,14 @@ void CMedicinaMountControlThread::runLoop()
			socket->setStatus(Antenna::ACU_CNTD);
			socket->setStatus(Antenna::ACU_CNTD);
		}
		}
	}
	}
	else {
		socket->updateComponent();  // before commenting out or deleting consider that inside this method the flushing of pending event of the log dike object is called
		try {		
			socket->detectOscillation();
		}
		catch (...) {
		}
		socket->checkPowerFailure();
		socket->checkCommandedMode();
	}
}
}