Removed compilation warnings with some GCC. + Fixed test for baudrate = none
authoretisserant
Wed, 18 Apr 2007 13:05:55 +0200
changeset 169 90c0a676e631
parent 168 f379cdef1f8e
child 170 d069631e9ca9
Removed compilation warnings with some GCC. + Fixed test for baudrate = none
examples/TestMasterMicroMod/TestMasterMicroMod.c
examples/TestMasterSlave/TestMasterSlave.c
--- a/examples/TestMasterMicroMod/TestMasterMicroMod.c	Wed Apr 18 13:05:15 2007 +0200
+++ b/examples/TestMasterMicroMod/TestMasterMicroMod.c	Wed Apr 18 13:05:55 2007 +0200
@@ -28,6 +28,7 @@
 	system("PAUSE");
 }
 #else
+#include <unistd.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -241,11 +242,11 @@
   printf("*                                                            *\n");
   printf("*  A simple example for PC.                                  *\n");
   printf("*  A CanOpen master that control a MicroMod module:          *\n");
-  printf("*  - setup module TPDO 1 transmit type (ignored ???)         *\n");
-  printf("*  - setup module RPDO 1 transmit type (ignored ???)         *\n");
+  printf("*  - setup module TPDO 1 transmit type (ignored ?)           *\n");
+  printf("*  - setup module RPDO 1 transmit type (ignored ?)           *\n");
   printf("*  - setup module hearbeatbeat period                        *\n");
   printf("*  - set state to operational                                *\n");
-  printf("*  - send periodic SYNC (ignored ???)                        *\n");
+  printf("*  - send periodic SYNC (ignored ?)                          *\n");
   printf("*  - send periodic RPDO 1 to Micromod (digital output)       *\n");
   printf("*  - listen Micromod's TPDO 1 (digital input)                *\n");
   printf("*                                                            *\n");
@@ -260,7 +261,7 @@
   printf("*                                                            *\n");
   printf("*    Master:                                                 *\n");
   printf("*     -m : bus name [\"1\"]                                    *\n");
-  printf("*     -M : 1M,500K,250K,125K,100K,50K,20K,10K,none(disable)  *\n");
+  printf("*     -M : 1M,500K,250K,125K,100K,50K,20K,10K                *\n");
   printf("*                                                            *\n");
   printf("**************************************************************\n");
 }
@@ -341,21 +342,18 @@
 	LoadCanDriver(LibraryPath);
 #endif		
 
-	if(MasterBoard.baudrate){
-		
-		TestMaster_Data.heartbeatError = TestMaster_heartbeatError;
-		TestMaster_Data.SDOtimeoutError = TestMaster_SDOtimeoutError;
-		TestMaster_Data.initialisation = TestMaster_initialisation;
-		TestMaster_Data.preOperational = TestMaster_preOperational;
-		TestMaster_Data.operational = TestMaster_operational;
-		TestMaster_Data.stopped = TestMaster_stopped;
-		TestMaster_Data.post_sync = TestMaster_post_sync;
-		TestMaster_Data.post_TPDO = TestMaster_post_TPDO;
-		
-		if(!canOpen(&MasterBoard,&TestMaster_Data)){
-			eprintf("Cannot open Master Board\n");
-			goto fail_master;
-		}
+	TestMaster_Data.heartbeatError = TestMaster_heartbeatError;
+	TestMaster_Data.SDOtimeoutError = TestMaster_SDOtimeoutError;
+	TestMaster_Data.initialisation = TestMaster_initialisation;
+	TestMaster_Data.preOperational = TestMaster_preOperational;
+	TestMaster_Data.operational = TestMaster_operational;
+	TestMaster_Data.stopped = TestMaster_stopped;
+	TestMaster_Data.post_sync = TestMaster_post_sync;
+	TestMaster_Data.post_TPDO = TestMaster_post_TPDO;
+	
+	if(!canOpen(&MasterBoard,&TestMaster_Data)){
+		eprintf("Cannot open Master Board\n");
+		goto fail_master;
 	}
 	
 	// Start timer thread
--- a/examples/TestMasterSlave/TestMasterSlave.c	Wed Apr 18 13:05:15 2007 +0200
+++ b/examples/TestMasterSlave/TestMasterSlave.c	Wed Apr 18 13:05:55 2007 +0200
@@ -30,8 +30,7 @@
 #else
 #include <stdio.h>
 #include <string.h>
-//#include <sys/time.h>
-//#include <unistd.h>
+#include <unistd.h>
 #include <stdlib.h>
 #include <signal.h>
 #endif
@@ -189,7 +188,7 @@
 	LoadCanDriver(LibraryPath);
 #endif		
 	// Open CAN devices
-	if(SlaveBoard.baudrate){
+	if(strcmp( SlaveBoard.baudrate, "none")){
 		
 		TestSlave_Data.heartbeatError = TestSlave_heartbeatError;
 		TestSlave_Data.SDOtimeoutError = TestSlave_SDOtimeoutError;
@@ -207,7 +206,7 @@
 		}
 	}
 
-	if(MasterBoard.baudrate){
+	if(strcmp( MasterBoard.baudrate, "none")){
 		
 		TestMaster_Data.heartbeatError = TestMaster_heartbeatError;
 		TestMaster_Data.SDOtimeoutError = TestMaster_SDOtimeoutError;