78 setState(d,Initialisation); |
78 setState(d,Initialisation); |
79 break; |
79 break; |
80 |
80 |
81 case NMT_Reset_Comunication: |
81 case NMT_Reset_Comunication: |
82 { |
82 { |
83 UNS8 newNodeId = getNodeId(d); |
83 UNS8 currentNodeId = getNodeId(d); |
84 |
84 |
85 if(d->NMT_Slave_Communications_Reset_Callback != NULL) |
85 if(d->NMT_Slave_Communications_Reset_Callback != NULL) |
86 d->NMT_Slave_Communications_Reset_Callback(d); |
86 d->NMT_Slave_Communications_Reset_Callback(d); |
87 #ifdef CO_ENABLE_LSS |
87 #ifdef CO_ENABLE_LSS |
88 // LSS changes NodeId here in case lss_transfer.nodeID doesn't |
88 // LSS changes NodeId here in case lss_transfer.nodeID doesn't |
89 // match current getNodeId() |
89 // match current getNodeId() |
90 if(newNodeId!=d->lss_transfer.nodeID && newNodeId>0 && newNodeId<=127 ) |
90 if(currentNodeId!=d->lss_transfer.nodeID) |
91 newNodeId = d->lss_transfer.nodeID; |
91 currentNodeId = d->lss_transfer.nodeID; |
92 #endif |
92 #endif |
93 |
93 |
94 // clear old NodeId to make SetNodeId reinitializing |
94 // clear old NodeId to make SetNodeId reinitializing |
95 // SDO, EMCY and other COB Ids |
95 // SDO, EMCY and other COB Ids |
96 *d->bDeviceNodeId = 0xFF; |
96 *d->bDeviceNodeId = 0xFF; |
97 |
97 |
98 setNodeId(d, newNodeId); |
98 setNodeId(d, currentNodeId); |
99 } |
99 } |
100 setState(d,Initialisation); |
100 setState(d,Initialisation); |
101 break; |
101 break; |
102 |
102 |
103 }/* end switch */ |
103 }/* end switch */ |