diff --git a/multicounter.c b/multicounter.c index c617b193..a1cf907a 100644 --- a/multicounter.c +++ b/multicounter.c @@ -108,7 +108,7 @@ static int MMCCStart(void *pData, SConnection *pCon) } /*-------------------------------------------------------------------------*/ static int MMCCStatus(void *pData, SConnection *pCon){ - int status,i, controlMonitor; + int status, slaveStatus, i, controlMonitor; pCounter pCountController = NULL; pCounter pCount = NULL; pMultiCounter self = NULL; @@ -127,7 +127,21 @@ static int MMCCStatus(void *pData, SConnection *pCon){ controlMonitor = GetControlMonitor((pCounter)pCount); pCountController = (pCounter)self->slaveData[controlMonitor]; - status = self->slaves[controlMonitor]->CheckCountStatus(pCountController,pCon); + if ( pCountController->pDriv->eMode == ePreset ) { + status = self->slaves[controlMonitor]->CheckCountStatus(pCountController,pCon); + } else { + status = HWIdle; + for(i = 0; i < self->nSlaves; i++){ + slaveStatus = self->slaves[i]->CheckCountStatus(pCountController,pCon); + if (slaveStatus == HWFault) { + status = HWFault; + break; + } else if (slaveStatus != HWIdle) { + status = slaveStatus; + break; + } + } + } if(status == HWIdle || status == HWFault){ /* stop counting on slaves when finished or when an error