properly deactivate slaves if there is no eoe slave
authorMatthias Luescher <ch1010472@ch10pc594>
Thu, 06 Jan 2011 17:19:15 +0100
changeset 2036 7fbc7bb7b95a
parent 2035 72a4e043e67d
child 2037 ea0319750e13
properly deactivate slaves if there is no eoe slave
master/master.c
--- a/master/master.c	Thu Jan 06 13:11:21 2011 +0100
+++ b/master/master.c	Thu Jan 06 17:19:15 2011 +0100
@@ -1958,6 +1958,7 @@
     ec_slave_t *slave;
 #ifdef EC_EOE
     ec_eoe_t *eoe;
+    int is_eoe_slave;
 #endif
 
     EC_MASTER_DBG(master, 1, "%s(master = 0x%p)\n", __func__, master);
@@ -1981,15 +1982,18 @@
 
         // set state to PREOP for all but eoe slaves
 #ifdef EC_EOE
+        is_eoe_slave = 0;
         // ... but leave EoE slaves in OP
         list_for_each_entry(eoe, &master->eoe_handlers, list) {
-            if (slave != eoe->slave || !ec_eoe_is_open(eoe)) {
-                ec_slave_request_state(slave, EC_SLAVE_STATE_PREOP);
-                // mark for reconfiguration, because the master could have no
-                // possibility for a reconfiguration between two sequential operation
-                // phases.
-                slave->force_config = 1;
-            }
+            if (slave == eoe->slave && ec_eoe_is_open(eoe))
+                is_eoe_slave = 1;
+       }
+       if (!is_eoe_slave) {
+           ec_slave_request_state(slave, EC_SLAVE_STATE_PREOP);
+           // mark for reconfiguration, because the master could have no
+           // possibility for a reconfiguration between two sequential operation
+           // phases.
+           slave->force_config = 1;
         }
 #else
         ec_slave_request_state(slave, EC_SLAVE_STATE_PREOP);