]> rtime.felk.cvut.cz Git - CanFestival-3.git/commitdiff
Edward's patch fixing nmtSlave compilation with LSS enabled.
authoretisserant <etisserant>
Tue, 22 Jul 2008 21:47:05 +0000 (21:47 +0000)
committeretisserant <etisserant>
Tue, 22 Jul 2008 21:47:05 +0000 (21:47 +0000)
src/nmtSlave.c

index dd7210055fd5ef30c4fc45e584cae7c8337ca468..ce69bb8aab7794da1cad8d356666aca45f6d35a3 100644 (file)
@@ -79,16 +79,26 @@ void proceedNMTstateChange(CO_Data* d, Message *m)
         break;
 
       case NMT_Reset_Comunication:
-         if(d->NMT_Slave_Communications_Reset_Callback != NULL)
-            d->NMT_Slave_Communications_Reset_Callback(d);
+         {
+         UNS8 newNodeId = getNodeId(d);
+         
+            if(d->NMT_Slave_Communications_Reset_Callback != NULL)
+               d->NMT_Slave_Communications_Reset_Callback(d);
 #ifdef CO_ENABLE_LSS
-         // LSS changes NodeId here in case lss_transfer.nodeID
-         // doesn't match current getNodeId()
-         if(newNodeId!=d->lss_transfer.nodeID && newNodeId>0 && newNodeId<=127 )
-            newNodeId = d->lss_transfer.nodeID;
+            // LSS changes NodeId here in case lss_transfer.nodeID doesn't 
+            // match current getNodeId()
+            if(newNodeId!=d->lss_transfer.nodeID && newNodeId>0 && newNodeId<=127 )
+               newNodeId = d->lss_transfer.nodeID;
 #endif
-        setState(d,Initialisation);
-        break;
+
+            // clear old NodeId to make SetNodeId reinitializing
+            // SDO, EMCY and other COB Ids
+            *d->bDeviceNodeId = 0xFF; 
+         
+            setNodeId(d, newNodeId);
+         }
+         setState(d,Initialisation);
+         break;
 
       }/* end switch */