fix bug in exit function
authorgreg
Tue, 27 May 2008 15:51:51 +0200
changeset 465 2ef560acfa86
parent 464 7d3637f763be
child 466 b71655eca5e2
fix bug in exit function
(add test to check if it is a master)
examples/TestMasterMicroMod/TestMasterMicroMod.c
examples/TestMasterSlave/TestMasterSlave.c
examples/TestMasterSlaveLSS/TestMasterSlaveLSS.c
--- a/examples/TestMasterMicroMod/TestMasterMicroMod.c	Fri May 09 10:25:45 2008 +0200
+++ b/examples/TestMasterMicroMod/TestMasterMicroMod.c	Tue May 27 15:51:51 2008 +0200
@@ -395,10 +395,12 @@
 /***************************  EXIT  *****************************************/
 void Exit(CO_Data* d, UNS32 id)
 {
-	masterSendNMTstateChange(&TestMaster_Data, 0x02, NMT_Reset_Node);
+	if(strcmp(MasterBoard.baudrate, "none")){
+		masterSendNMTstateChange(&TestMaster_Data, 0x02, NMT_Reset_Node);
     
-    //Stop master
-	setState(&TestMaster_Data, Stopped);
+    	//Stop master
+		setState(&TestMaster_Data, Stopped);
+	}
 }
 /****************************************************************************/
 /***************************  MAIN  *****************************************/
--- a/examples/TestMasterSlave/TestMasterSlave.c	Fri May 09 10:25:45 2008 +0200
+++ b/examples/TestMasterSlave/TestMasterSlave.c	Tue May 27 15:51:51 2008 +0200
@@ -116,10 +116,13 @@
 /***************************  EXIT  *****************************************/
 void Exit(CO_Data* d, UNS32 id)
 {
-	masterSendNMTstateChange(&TestMaster_Data, 0x02, NMT_Reset_Node);    
+	if(strcmp(MasterBoard.baudrate, "none")){
+		
+		masterSendNMTstateChange(&TestMaster_Data, 0x02, NMT_Reset_Node);    
     
-    //Stop master
-	setState(&TestMaster_Data, Stopped);
+    	//Stop master
+		setState(&TestMaster_Data, Stopped);
+	}
 }
 
 /****************************************************************************/
--- a/examples/TestMasterSlaveLSS/TestMasterSlaveLSS.c	Fri May 09 10:25:45 2008 +0200
+++ b/examples/TestMasterSlaveLSS/TestMasterSlaveLSS.c	Tue May 27 15:51:51 2008 +0200
@@ -125,6 +125,7 @@
 /***************************  EXIT  *****************************************/
 void Exit(CO_Data* d, UNS32 id)
 {
+	if(strcmp(MasterBoard.baudrate, "none")){
 	eprintf("Finishing.\n");
 	masterSendNMTstateChange (&TestMaster_Data, 0x00, NMT_Stop_Node);
 
@@ -132,7 +133,7 @@
 
 	// Stop master
 	setState(&TestMaster_Data, Stopped);
-
+	}
 }
 
 /****************************************************************************/