Fixed bug if scanning is not allowed when link goes up.
--- a/master/fsm_master.c Mon Mar 03 13:26:32 2008 +0000
+++ b/master/fsm_master.c Mon Mar 03 16:17:23 2008 +0000
@@ -298,11 +298,15 @@
}
}
- // fetch state from each slave
- fsm->slave = list_entry(master->slaves.next, ec_slave_t, list);
- ec_datagram_fprd(fsm->datagram, fsm->slave->station_address, 0x0130, 2);
- fsm->retries = EC_FSM_RETRIES;
- fsm->state = ec_fsm_master_state_read_states;
+ if (list_empty(&master->slaves)) {
+ fsm->state = ec_fsm_master_state_end;
+ } else {
+ // fetch state from each slave
+ fsm->slave = list_entry(master->slaves.next, ec_slave_t, list);
+ ec_datagram_fprd(fsm->datagram, fsm->slave->station_address, 0x0130, 2);
+ fsm->retries = EC_FSM_RETRIES;
+ fsm->state = ec_fsm_master_state_read_states;
+ }
}
/*****************************************************************************/