Improve tutorial and documentation
This commit is contained in:
parent
cfd5adfdcd
commit
6c37e949e0
@ -38,7 +38,7 @@ have a dedicated NIC selected in the nicdrv.c. It returns >0 if succeeded.
|
||||
\code
|
||||
|
||||
/* initialise SOEM, bind socket to ifname */
|
||||
if (ec_init(ifname))
|
||||
if (ec_init(ifname) > 0)
|
||||
|
||||
\endcode
|
||||
|
||||
@ -120,8 +120,10 @@ That is the primary key to detect errors.
|
||||
\code
|
||||
|
||||
char IOmap[128];
|
||||
int usedmem;
|
||||
...
|
||||
ec_config_map(&IOmap);
|
||||
usedmem = ec_config_map(&IOmap);
|
||||
if (usedmem <= sizeof(IOmap))
|
||||
...
|
||||
\endcode
|
||||
|
||||
@ -258,7 +260,7 @@ if( inOP && ((wkc < expectedWKC) || ec_group[currentgroup].docheckstate))
|
||||
ec_slave[slave].state = EC_STATE_OPERATIONAL;
|
||||
ec_writestate(slave);
|
||||
}
|
||||
else if(ec_slave[slave].state > 0)
|
||||
else if(ec_slave[slave].state > EC_STATE_NONE)
|
||||
{
|
||||
if (ec_reconfig_slave(slave, EC_TIMEOUTMON))
|
||||
{
|
||||
@ -270,7 +272,7 @@ if( inOP && ((wkc < expectedWKC) || ec_group[currentgroup].docheckstate))
|
||||
{
|
||||
/* re-check state */
|
||||
ec_statecheck(slave, EC_STATE_OPERATIONAL, EC_TIMEOUTRET);
|
||||
if (!ec_slave[slave].state)
|
||||
if (ec_slave[slave].state == EC_STATE_NONE)
|
||||
{
|
||||
ec_slave[slave].islost = TRUE;
|
||||
printf("ERROR : slave %d lost\n",slave);
|
||||
@ -279,7 +281,7 @@ if( inOP && ((wkc < expectedWKC) || ec_group[currentgroup].docheckstate))
|
||||
}
|
||||
if (ec_slave[slave].islost)
|
||||
{
|
||||
if(!ec_slave[slave].state)
|
||||
if(ec_slave[slave].state == EC_STATE_NONE)
|
||||
{
|
||||
if (ec_recover_slave(slave, EC_TIMEOUTMON))
|
||||
{
|
||||
|
@ -259,7 +259,7 @@ typedef struct
|
||||
uint8 group;
|
||||
/** first unused FMMU */
|
||||
uint8 FMMUunused;
|
||||
/** TRUE is slave is not responding at all */
|
||||
/** Boolean for tracking whether the slave is (not) responding, not used/set by the SOEM library */
|
||||
boolean islost;
|
||||
/** registered configuration function PO->SO */
|
||||
int (*PO2SOconfig)(uint16 slave);
|
||||
|
@ -179,12 +179,14 @@ typedef enum
|
||||
/** Possible EtherCAT slave states */
|
||||
typedef enum
|
||||
{
|
||||
/** No valid state. */
|
||||
EC_STATE_NONE = 0x00,
|
||||
/** Init state*/
|
||||
EC_STATE_INIT = 0x01,
|
||||
/** Pre-operational. */
|
||||
EC_STATE_PRE_OP = 0x02,
|
||||
/** Boot state*/
|
||||
EC_STATE_BOOT = 0x03,
|
||||
EC_STATE_BOOT = 0x03,
|
||||
/** Safe-operational. */
|
||||
EC_STATE_SAFE_OP = 0x04,
|
||||
/** Operational */
|
||||
|
@ -257,7 +257,7 @@ OSAL_THREAD_FUNC ecatcheck( void *ptr )
|
||||
ec_slave[slave].state = EC_STATE_OPERATIONAL;
|
||||
ec_writestate(slave);
|
||||
}
|
||||
else if(ec_slave[slave].state > 0)
|
||||
else if(ec_slave[slave].state > EC_STATE_NONE)
|
||||
{
|
||||
if (ec_reconfig_slave(slave, EC_TIMEOUTMON))
|
||||
{
|
||||
@ -269,7 +269,7 @@ OSAL_THREAD_FUNC ecatcheck( void *ptr )
|
||||
{
|
||||
/* re-check state */
|
||||
ec_statecheck(slave, EC_STATE_OPERATIONAL, EC_TIMEOUTRET);
|
||||
if (!ec_slave[slave].state)
|
||||
if (ec_slave[slave].state == EC_STATE_NONE)
|
||||
{
|
||||
ec_slave[slave].islost = TRUE;
|
||||
printf("ERROR : slave %d lost\n",slave);
|
||||
@ -278,7 +278,7 @@ OSAL_THREAD_FUNC ecatcheck( void *ptr )
|
||||
}
|
||||
if (ec_slave[slave].islost)
|
||||
{
|
||||
if(!ec_slave[slave].state)
|
||||
if(ec_slave[slave].state == EC_STATE_NONE)
|
||||
{
|
||||
if (ec_recover_slave(slave, EC_TIMEOUTMON))
|
||||
{
|
||||
|
@ -176,7 +176,7 @@ OSAL_THREAD_FUNC ecatcheck( void *ptr )
|
||||
ec_slave[slave].state = EC_STATE_OPERATIONAL;
|
||||
ec_writestate(slave);
|
||||
}
|
||||
else if(ec_slave[slave].state > 0)
|
||||
else if(ec_slave[slave].state > EC_STATE_NONE)
|
||||
{
|
||||
if (ec_reconfig_slave(slave, EC_TIMEOUTMON))
|
||||
{
|
||||
@ -188,7 +188,7 @@ OSAL_THREAD_FUNC ecatcheck( void *ptr )
|
||||
{
|
||||
/* re-check state */
|
||||
ec_statecheck(slave, EC_STATE_OPERATIONAL, EC_TIMEOUTRET);
|
||||
if (!ec_slave[slave].state)
|
||||
if (ec_slave[slave].state == EC_STATE_NONE)
|
||||
{
|
||||
ec_slave[slave].islost = TRUE;
|
||||
printf("ERROR : slave %d lost\n",slave);
|
||||
@ -197,7 +197,7 @@ OSAL_THREAD_FUNC ecatcheck( void *ptr )
|
||||
}
|
||||
if (ec_slave[slave].islost)
|
||||
{
|
||||
if(!ec_slave[slave].state)
|
||||
if(ec_slave[slave].state == EC_STATE_NONE)
|
||||
{
|
||||
if (ec_recover_slave(slave, EC_TIMEOUTMON))
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ OSAL_THREAD_FUNC ecatcheck(void *lpParam)
|
||||
ec_slave[slave].state = EC_STATE_OPERATIONAL;
|
||||
ec_writestate(slave);
|
||||
}
|
||||
else if(ec_slave[slave].state > 0)
|
||||
else if(ec_slave[slave].state > EC_STATE_NONE)
|
||||
{
|
||||
if (ec_reconfig_slave(slave, EC_TIMEOUTMON))
|
||||
{
|
||||
@ -307,7 +307,7 @@ OSAL_THREAD_FUNC ecatcheck(void *lpParam)
|
||||
{
|
||||
/* re-check state */
|
||||
ec_statecheck(slave, EC_STATE_OPERATIONAL, EC_TIMEOUTRET);
|
||||
if (!ec_slave[slave].state)
|
||||
if (ec_slave[slave].state == EC_STATE_NONE)
|
||||
{
|
||||
ec_slave[slave].islost = TRUE;
|
||||
printf("ERROR : slave %d lost\n",slave);
|
||||
@ -316,7 +316,7 @@ OSAL_THREAD_FUNC ecatcheck(void *lpParam)
|
||||
}
|
||||
if (ec_slave[slave].islost)
|
||||
{
|
||||
if(!ec_slave[slave].state)
|
||||
if(ec_slave[slave].state == EC_STATE_NONE)
|
||||
{
|
||||
if (ec_recover_slave(slave, EC_TIMEOUTMON))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user