Reconfiguration of slaves, though they are in the correct state at startup.

This commit is contained in:
Florian Pose 2006-10-20 10:48:30 +00:00
parent ce9cf72367
commit c800b84949
3 changed files with 21 additions and 8 deletions

View File

@ -571,15 +571,24 @@ void ec_fsm_master_action_process_states(ec_fsm_t *fsm
// check if any slaves are not in the state, they're supposed to be
list_for_each_entry(slave, &master->slaves, list) {
if (slave->error_flag ||
!slave->online ||
slave->requested_state == EC_SLAVE_STATE_UNKNOWN ||
slave->current_state == slave->requested_state) continue;
if (slave->error_flag
|| !slave->online
|| slave->requested_state == EC_SLAVE_STATE_UNKNOWN
|| (slave->current_state == slave->requested_state
&& (slave->configured
|| slave->current_state == EC_SLAVE_STATE_INIT))) continue;
ec_state_string(slave->current_state, old_state);
ec_state_string(slave->requested_state, new_state);
EC_INFO("Changing state of slave %i from %s to %s.\n",
slave->ring_position, old_state, new_state);
if (!slave->configured
&& slave->current_state != EC_SLAVE_STATE_INIT) {
EC_INFO("Reconfiguring slave %i.\n", slave->ring_position);
}
if (slave->current_state != slave->requested_state) {
ec_state_string(slave->current_state, old_state);
ec_state_string(slave->requested_state, new_state);
EC_INFO("Changing state of slave %i from %s to %s.\n",
slave->ring_position, old_state, new_state);
}
fsm->slave = slave;
fsm->slave_state = ec_fsm_slaveconf_init;
@ -1399,6 +1408,8 @@ void ec_fsm_slaveconf_init(ec_fsm_t *fsm /**< finite state machine */)
if (fsm->change_state != ec_fsm_end) return;
slave->configured = 1;
if (master->debug_level) {
EC_DBG("Slave %i is now in INIT.\n", slave->ring_position);
}

View File

@ -132,6 +132,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->configured = 0;
slave->error_flag = 0;
slave->online = 1;
slave->fmmu_count = 0;

View File

@ -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 configured; /**< the slave is configured by this master */
unsigned int error_flag; /**< stop processing after an error */
unsigned int online; /**< non-zero, if the slave responds. */
uint8_t registered; /**< true, if slave has been registered */