changes merged
author'Gr?gory Tr?lat <gregory.trelat@lolitech.fr>'
Thu, 08 Oct 2009 17:34:44 +0200
changeset 606 15a175f6305d
parent 605 f91ee161b3a1 (diff)
parent 604 96e632bc1e58 (current diff)
child 607 5fec528f66cf
child 609 c59dce78bbad
changes merged
drivers/timers_win32/timers_win32.c
--- a/drivers/timers_win32/timers_win32.c	Wed Oct 07 11:40:49 2009 +0200
+++ b/drivers/timers_win32/timers_win32.c	Thu Oct 08 17:34:44 2009 +0200
@@ -79,10 +79,7 @@
 
 int TimerThreadLoop(void)
 {
-	EnterMutex();
-	// At first, TimeDispatch will call init_callback.
-	SetAlarm(NULL, 0, init_callback, 0, 0);
-	LeaveMutex();
+
 
 	while(!stop_timer)
 	{
@@ -140,6 +137,10 @@
 	unsigned long timer_thread_id;
 	stop_timer = 0;
 	init_callback = _init_callback;
+	EnterMutex();
+		// At first, TimeDispatch will call init_callback.
+	SetAlarm(NULL, 0, init_callback, 0, 0);
+	LeaveMutex();
 	timer_thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)TimerThreadLoop, NULL, 0, &timer_thread_id);
 }
 
--- a/examples/CANOpenShell/CANOpenShell.c	Wed Oct 07 11:40:49 2009 +0200
+++ b/examples/CANOpenShell/CANOpenShell.c	Thu Oct 08 17:34:44 2009 +0200
@@ -55,7 +55,7 @@
 
 //****************************************************************************
 // GLOBALS
-char BoardBusName[11];
+char BoardBusName[31];
 char BoardBaudRate[5];
 s_BOARD Board = {BoardBusName, BoardBaudRate};
 CO_Data* CANOpenShellOD_Data;
@@ -407,7 +407,7 @@
 					LeaveMutex();
 					return QUIT;
 		case cst_str4('l', 'o', 'a', 'd') : /* Library Interface*/
-					ret = sscanf(command, "load#%100[^,],%10[^,],%4[^,],%d,%d",
+					ret = sscanf(command, "load#%100[^,],%30[^,],%4[^,],%d,%d",
 							LibraryPath,
 							BoardBusName,
 							BoardBaudRate,
@@ -416,10 +416,14 @@
 
 					if(ret == 5)
 					{
+						LeaveMutex();
 						ret = NodeInit(NodeID, NodeType);
-						LeaveMutex();
 						return ret;
 					}
+					else
+					{
+						printf("Invalid load parameters\n");
+					}
 					break;
 		default :
 					help_menu();