src/nmtSlave.c
changeset 498 aae8531341df
parent 483 763ae2ca410a
child 517 003679edc437
equal deleted inserted replaced
497:a040156aa72f 498:aae8531341df
    77             d->NMT_Slave_Node_Reset_Callback(d);
    77             d->NMT_Slave_Node_Reset_Callback(d);
    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          if(d->NMT_Slave_Communications_Reset_Callback != NULL)
    82          {
    83             d->NMT_Slave_Communications_Reset_Callback(d);
    83          UNS8 newNodeId = getNodeId(d);
       
    84          
       
    85             if(d->NMT_Slave_Communications_Reset_Callback != NULL)
       
    86                d->NMT_Slave_Communications_Reset_Callback(d);
    84 #ifdef CO_ENABLE_LSS
    87 #ifdef CO_ENABLE_LSS
    85          // LSS changes NodeId here in case lss_transfer.nodeID
    88             // LSS changes NodeId here in case lss_transfer.nodeID doesn't 
    86          // doesn't match current getNodeId()
    89             // match current getNodeId()
    87          if(newNodeId!=d->lss_transfer.nodeID && newNodeId>0 && newNodeId<=127 )
    90             if(newNodeId!=d->lss_transfer.nodeID && newNodeId>0 && newNodeId<=127 )
    88             newNodeId = d->lss_transfer.nodeID;
    91                newNodeId = d->lss_transfer.nodeID;
    89 #endif
    92 #endif
    90         setState(d,Initialisation);
    93 
    91         break;
    94             // clear old NodeId to make SetNodeId reinitializing
       
    95             // SDO, EMCY and other COB Ids
       
    96             *d->bDeviceNodeId = 0xFF; 
       
    97          
       
    98             setNodeId(d, newNodeId);
       
    99          }
       
   100          setState(d,Initialisation);
       
   101          break;
    92 
   102 
    93       }/* end switch */
   103       }/* end switch */
    94 
   104 
    95     }/* end if( ( (*m).data[1] == 0 ) || ( (*m).data[1] ==
   105     }/* end if( ( (*m).data[1] == 0 ) || ( (*m).data[1] ==
    96         bDeviceNodeId ) ) */
   106         bDeviceNodeId ) ) */