Debug messaged on configuring assignment and mapping.
authorFlorian Pose <fp@igh-essen.com>
Mon, 07 Apr 2008 15:47:22 +0000
changeset 890 1115793a76ed
parent 889 661b61ca86ed
child 891 fab139acf3b2
Debug messaged on configuring assignment and mapping.
master/fsm_pdo_assign.c
master/fsm_pdo_assign.h
master/fsm_pdo_mapping.c
master/fsm_pdo_mapping.h
--- a/master/fsm_pdo_assign.c	Mon Apr 07 15:12:43 2008 +0000
+++ b/master/fsm_pdo_assign.c	Mon Apr 07 15:47:22 2008 +0000
@@ -152,6 +152,7 @@
     }
 
     fsm->dir = (ec_direction_t) -1; // next is EC_DIR_OUTPUT
+    fsm->num_configured_dirs = 0;
     ec_fsm_pdo_assign_next_dir(fsm);
 }
 
@@ -191,6 +192,8 @@
             return;
         }
 
+        fsm->num_configured_dirs++;
+
         if (fsm->slave->master->debug_level) {
             EC_DBG("Changing Pdo assignment for SM%u of slave %u.\n",
                     fsm->sync->index, fsm->slave->ring_position);
@@ -215,9 +218,9 @@
         return;
     }
 
-    if (fsm->slave->master->debug_level)
-        EC_DBG("Pdo assignment finished for slave %u.\n",
-                fsm->slave->ring_position);
+    if (fsm->slave->master->debug_level && !fsm->num_configured_dirs)
+        EC_DBG("Pdo assignments of slave %u are already configured"
+                " correctly.\n", fsm->slave->ring_position);
     fsm->state = ec_fsm_pdo_assign_state_end;
 }
 
@@ -348,8 +351,8 @@
     }
 
     if (fsm->slave->master->debug_level)
-        EC_DBG("Successfully set Pdo assignment for SM%u of slave %u.\n",
-                fsm->sync->index, fsm->slave->ring_position);
+        EC_DBG("Successfully configured Pdo assignment for SM%u of"
+                " slave %u.\n", fsm->sync->index, fsm->slave->ring_position);
 
     // assignment for this direction finished
     ec_fsm_pdo_assign_next_dir(fsm);
--- a/master/fsm_pdo_assign.h	Mon Apr 07 15:12:43 2008 +0000
+++ b/master/fsm_pdo_assign.h	Mon Apr 07 15:47:22 2008 +0000
@@ -63,8 +63,9 @@
     ec_slave_t *slave; /**< Slave the FSM runs on. */
 
     ec_direction_t dir; /**< Current direction. */
+    const ec_pdo_list_t *pdos; /**< Target Pdo assignment. */
     const ec_sync_t *sync; /**< Current sync manager. */
-    const ec_pdo_list_t *pdos; /**< Target Pdo assignment. */
+    unsigned int num_configured_dirs; /**< Number of configured directions. */
     const ec_pdo_t *pdo; /**< Current Pdo. */
 
     ec_sdo_request_t request; /**< Sdo request. */
--- a/master/fsm_pdo_mapping.c	Mon Apr 07 15:12:43 2008 +0000
+++ b/master/fsm_pdo_mapping.c	Mon Apr 07 15:47:22 2008 +0000
@@ -149,6 +149,7 @@
     }
 
     fsm->pdo = NULL;
+    fsm->num_configured_pdos = 0;
     ec_fsm_pdo_mapping_next_pdo(fsm);
 }
 
@@ -169,7 +170,7 @@
 
         list_for_each_entry(pdo, &pdos->list, list) {
             if (fsm->pdo) { // there was a Pdo mapping changed in the last run
-                if (pdo == fsm->pdo) // this is the last Pdo
+                if (pdo == fsm->pdo) // this is the previously configured Pdo
                     fsm->pdo = NULL; // take the next one
             } else {
                 if ((assigned_pdo = ec_slave_find_pdo(fsm->slave, pdo->index)))
@@ -177,15 +178,16 @@
                         continue; // Pdo entries mapped correctly
 
                 fsm->pdo = pdo;
+                fsm->num_configured_pdos++;
                 break;
             }
         }
     }
 
     if (!fsm->pdo) {
-        if (fsm->slave->master->debug_level)
-            EC_DBG("Pdo mapping finished for slave %u.\n",
-                    fsm->slave->ring_position);
+        if (fsm->slave->master->debug_level && !fsm->num_configured_pdos)
+            EC_DBG("Pdo mappings of slave %u are already configured"
+                    " correctly.\n", fsm->slave->ring_position);
         fsm->state = ec_fsm_pdo_mapping_state_end;
         return;
     }
--- a/master/fsm_pdo_mapping.h	Mon Apr 07 15:12:43 2008 +0000
+++ b/master/fsm_pdo_mapping.h	Mon Apr 07 15:47:22 2008 +0000
@@ -61,6 +61,7 @@
     ec_slave_t *slave; /**< Slave the FSM runs on. */
 
     const ec_pdo_t *pdo; /**< Current Pdo to configure. */
+    unsigned int num_configured_pdos; /**< Number of configured Pdos. */
     const ec_pdo_entry_t *entry; /**< Current entry. */
 
     ec_sdo_request_t request; /**< Sdo request. */