Re-added slave.configured flag as slave.self_configured.
authorFlorian Pose <fp@igh-essen.com>
Tue, 09 Jan 2007 14:36:08 +0000
changeset 523 584a4f60b067
parent 522 de914aa62273
child 524 5ffcb9b9f17d
Re-added slave.configured flag as slave.self_configured.
master/fsm.c
master/slave.c
master/slave.h
--- a/master/fsm.c	Tue Jan 09 14:19:37 2007 +0000
+++ b/master/fsm.c	Tue Jan 09 14:36:08 2007 +0000
@@ -325,13 +325,20 @@
         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 @@
         return;
     }
 
+    slave->self_configured = 1;
+
     if (master->debug_level) {
         EC_DBG("Slave %i is now in INIT.\n", slave->ring_position);
     }
--- a/master/slave.c	Tue Jan 09 14:19:37 2007 +0000
+++ b/master/slave.c	Tue Jan 09 14:36:08 2007 +0000
@@ -112,6 +112,7 @@
 
     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;
--- a/master/slave.h	Tue Jan 09 14:19:37 2007 +0000
+++ b/master/slave.h	Tue Jan 09 14:36:08 2007 +0000
@@ -197,6 +197,7 @@
 
     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. */