Edward's patch fixing nmtSlave compilation with LSS enabled.
--- a/src/nmtSlave.c Tue Jul 22 23:44:07 2008 +0200
+++ b/src/nmtSlave.c Tue Jul 22 23:47:05 2008 +0200
@@ -79,16 +79,26 @@
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 */