diff --git a/master/fsm.c b/master/fsm.c index 9d8e5c984ffd59fbca114d76ef61eaf3ee74c21e..1780eea48684f0dccef058fc4ff7ce4fe6a54716 100644 --- a/master/fsm.c +++ b/master/fsm.c @@ -325,13 +325,20 @@ void ec_fsm_master_action_process_states(ec_fsm_t *fsm if (slave->error_flag || !slave->online || slave->requested_state == EC_SLAVE_STATE_UNKNOWN - || slave->current_state == slave->requested_state) continue; + || (slave->current_state == slave->requested_state + && slave->self_configured)) continue; if (master->debug_level) { ec_state_string(slave->current_state, old_state); - ec_state_string(slave->requested_state, new_state); - EC_DBG("Changing state of slave %i (%s -> %s).\n", - slave->ring_position, old_state, new_state); + if (slave->current_state != slave->requested_state) { + ec_state_string(slave->requested_state, new_state); + EC_DBG("Changing state of slave %i (%s -> %s).\n", + slave->ring_position, old_state, new_state); + } + else if (!slave->self_configured) { + EC_DBG("Reconfiguring slave %i (%s).\n", + slave->ring_position, old_state); + } } fsm->master_state = ec_fsm_master_configure_slave; @@ -1308,6 +1315,8 @@ void ec_fsm_slaveconf_state_init(ec_fsm_t *fsm /**< finite state machine */) return; } + slave->self_configured = 1; + if (master->debug_level) { EC_DBG("Slave %i is now in INIT.\n", slave->ring_position); } diff --git a/master/slave.c b/master/slave.c index d23cdebf9ec3712b06ab4c0c5c15cac9efa22d11..b3fbae1c12cc7da05cc1870ec69f39b20171a4c5 100644 --- a/master/slave.c +++ b/master/slave.c @@ -112,6 +112,7 @@ int ec_slave_init(ec_slave_t *slave, /**< EtherCAT slave */ slave->requested_state = EC_SLAVE_STATE_UNKNOWN; slave->current_state = EC_SLAVE_STATE_UNKNOWN; + slave->self_configured = 0; slave->error_flag = 0; slave->online = 1; slave->fmmu_count = 0; diff --git a/master/slave.h b/master/slave.h index aabdd0d592bd39c7d3c7bead333dcd4e1d0655b5..a9d19c368e0760f48dfd5174196ce6dd0e09eb39 100644 --- a/master/slave.h +++ b/master/slave.h @@ -197,6 +197,7 @@ struct ec_slave ec_slave_state_t requested_state; /**< requested slave state */ ec_slave_state_t current_state; /**< current slave state */ + unsigned int self_configured; /**< slave was configured by this master */ unsigned int error_flag; /**< stop processing after an error */ unsigned int online; /**< non-zero, if the slave responds. */