EgtMachKernel :
- correzioni a Disposition per gestione stato - modifiche a SetAxisPos per restituire la posizione effettivamente raggiunta - modifiche a Simulator per gestire errori da PathStartAux e PathEndAux.
This commit is contained in:
+21
-9
@@ -788,8 +788,9 @@ Simulator::ManagePathStartAux( int& nStatus)
|
||||
return false ;
|
||||
}
|
||||
// richiamo gestione evento ausiliario prima di inizio percorso di lavoro
|
||||
if ( ! OnPathStartAux( m_nAuxSInd, sAS)) {
|
||||
nStatus = ( Stopped() ? MCH_SIM_STOP : MCH_SIM_ERR) ;
|
||||
int nErr ;
|
||||
if ( ! OnPathStartAux( m_nAuxSInd, sAS, nErr)) {
|
||||
nStatus = ( Stopped() ? MCH_SIM_STOP : ( nErr == 1 ? MCH_SIM_OUTSTROKE : MCH_SIM_ERR)) ;
|
||||
return false ;
|
||||
}
|
||||
nStatus = MCH_SIM_END_STEP ;
|
||||
@@ -809,8 +810,9 @@ Simulator::ManagePathEndAux( int& nStatus)
|
||||
return false ;
|
||||
}
|
||||
// richiamo gestione evento ausiliario dopo fine percorso di lavoro
|
||||
if ( ! OnPathEndAux( m_nAuxEInd, sAE)) {
|
||||
nStatus = ( Stopped() ? MCH_SIM_STOP : MCH_SIM_ERR) ;
|
||||
int nErr ;
|
||||
if ( ! OnPathEndAux( m_nAuxEInd, sAE, nErr)) {
|
||||
nStatus = ( Stopped() ? MCH_SIM_STOP : ( nErr == 1 ? MCH_SIM_OUTSTROKE : MCH_SIM_ERR)) ;
|
||||
return false ;
|
||||
}
|
||||
nStatus = MCH_SIM_END_STEP ;
|
||||
@@ -1345,36 +1347,46 @@ Simulator::OnPathEnd( int nAE)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnPathStartAux( int nInd, const string& sAS)
|
||||
Simulator::OnPathStartAux( int nInd, const string& sAS, int& nErr)
|
||||
{
|
||||
// reset stato di errore da script
|
||||
nErr = 0 ;
|
||||
// verifico esistenza funzione
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_PATH_START_AUX))
|
||||
return true ;
|
||||
// assegno indice e valore dato ausiliario
|
||||
// assegno indice, valore dato ausiliario e resetto errore
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXIND, nInd) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUX, sAS) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
|
||||
// chiamo la funzione di evento ausiliario all'inizio del percorso
|
||||
bOk = bOk && m_pMachine->LuaCallFunction( ON_SIMUL_PATH_START_AUX) ;
|
||||
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
|
||||
UpdateAxesPos() ;
|
||||
return bOk ;
|
||||
// verifico codice di errore
|
||||
bOk = bOk && m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
|
||||
return ( bOk && nErr == 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnPathEndAux( int nInd, const string& sAE)
|
||||
Simulator::OnPathEndAux( int nInd, const string& sAE, int& nErr)
|
||||
{
|
||||
// reset stato di errore da script
|
||||
nErr = 0 ;
|
||||
// verifico esistenza funzione
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_PATH_END_AUX))
|
||||
return true ;
|
||||
// assegno identificativo e indice percorso di lavorazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXIND, nInd) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUX, sAE) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
|
||||
// chiamo la funzione di evento ausiliario alla fine del percorso
|
||||
bOk = bOk && m_pMachine->LuaCallFunction( ON_SIMUL_PATH_END_AUX) ;
|
||||
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
|
||||
UpdateAxesPos() ;
|
||||
return bOk ;
|
||||
// verifico codice di errore
|
||||
bOk = bOk && m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
|
||||
return ( bOk && nErr == 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user