Index: branch/mbaye/Emb_App/programme_principal_etud.c
===================================================================
--- branch/mbaye/Emb_App/programme_principal_etud.c	(revision 389)
+++ branch/mbaye/Emb_App/programme_principal_etud.c	(revision 390)
@@ -126,9 +126,10 @@
 int capt;
 UINT flag;
 int dist;
-//UINT flag_C;
+int info_piste;
+int numero_p;
+int feu;
 
-
 void asserv_T()
 {
 	while(1)
@@ -142,7 +143,7 @@
 	  // dly_tsk(100);
 	
 	   comm.data.id='T'; comm.data.rtr=0; 
-	   comm.data.val=1.0*(585-pos);
+	   comm.data.val=1.0*(450-pos);
 	   snd_dtq (CanTx,comm.msg);
 	   dly_tsk(100);
 	}
@@ -160,46 +161,129 @@
        dis = periph[ADDR('U')].val;
 	   
 	   comm.data.id='D'; comm.data.rtr=0; 
-	   if(capt==(0x5603))
+	   
+	   if(numero_p==0x0002)
 	   {
+	    if(capt==(0x5603))
+	    {
 		   comm.data.val=0;
 	       snd_dtq (CanTx,comm.msg);
-		    if (dis>585) 
+		    if (dis>710) 
 	        {
-		      dis = 585;
-	       }
+		      dis = 710;
+	        }
 		    else
 	        {
 			  dis = periph[ADDR('U')].val;
-	          comm.data.val=-1.5*(585-dis);
+	          comm.data.val=-1.0*(710-dis);
 	          snd_dtq (CanTx,comm.msg);
 	        }
+	     }
+		else
+		{
+			comm.data.val=-1.0*(710-dis);
+	        snd_dtq (CanTx,comm.msg);
+		}
 	   }
-	   else
+	   else if(numero_p==0x0003)
 	   {
-	       comm.data.val=-1.5*(585-dis);
+		   if(capt==(0x5601))
+	       {
+		      comm.data.val=0;
+	          snd_dtq (CanTx,comm.msg);
+		      if (dis>1000) 
+	          {
+		         dis = 710;
+	          }
+		      else
+	          {
+			     dis = periph[ADDR('U')].val;
+	             comm.data.val=-1.0*(710-dis);
+	             snd_dtq (CanTx,comm.msg);
+	          }
+	       }
+		   else if(capt==(0x5602))
+		   {
+			   comm.data.val=0;
+	           snd_dtq (CanTx,comm.msg);
+		       if (dis>1000) 
+	           {
+		         dis = 710;
+	           }
+		       else
+	           {
+			     dis = periph[ADDR('U')].val;
+	             comm.data.val=-1.0*(710-dis);
+	             snd_dtq (CanTx,comm.msg);
+	           }
+	       }
+		   else
+		   {
+			  comm.data.val=-1.0*(710-dis);
+	          snd_dtq (CanTx,comm.msg);
+		   }
+	   }
+	   else if(numero_p==0x0001)
+	   {
+		   comm.data.val=-1.0*(710-dis);
 	       snd_dtq (CanTx,comm.msg);
 	   }
-	   
-	    //dly_tsk(100);
+	   dly_tsk(100);
 	}
 }
 void vitesse_roue()
 {
-	CanFrame comm;
-	comm.data.id='V'; comm.data.rtr=0; 
-	if(capt==(0x5603))
+	while(1)
 	{
-	   comm.data.val=45;
-	   snd_dtq (CanTx,comm.msg);
+	  CanFrame comm;
+	  comm.data.id='V'; comm.data.rtr=0; 
+      dly_tsk(3000);
+	  if(Bp_G==1)
+	  {
+		  comm.data.val=0;
+	      snd_dtq (CanTx,comm.msg);
+	  }
+	    else if(numero_p==0x0001)
+		{
+		  if(capt==5603)
+		  {
+	        comm.data.val=30;
+	        snd_dtq (CanTx,comm.msg);
+		  }
+		  else
+		  {
+		    comm.data.val=10;
+	        snd_dtq (CanTx,comm.msg);	
+		  }
+		}
+	    else if(numero_p==0x0002)
+		{
+		  if(capt==5603)
+		  {
+	        comm.data.val=30;
+	        snd_dtq (CanTx,comm.msg);
+		  }
+		  else
+		  {
+		    comm.data.val=10;
+	        snd_dtq (CanTx,comm.msg);	
+		  }
+		}
+		else if(numero_p==0x0003)
+		{
+		  if(capt==5603)
+		  {
+	        comm.data.val=60;
+	        snd_dtq (CanTx,comm.msg);
+	 	  }
+		  else
+		  {
+		    comm.data.val=10;
+	        snd_dtq (CanTx,comm.msg);	
+		  }
+	     }
+	 dly_tsk(100);
 	}
-	else
-	{
-	   dly_tsk(3000);
-	   comm.data.val=10;
-	   snd_dtq (CanTx,comm.msg);
-	}
-	//dly_tsk(100);
 }
 void info_capt()
 {
@@ -214,7 +298,31 @@
 	   dly_tsk(100);
 	}
 }
-
+void mode_course()
+{
+	while(1)
+	{
+	   CanFrame req;
+	   req.data.id='M'; req.data.rtr=1;
+	   periph[ADDR('M')].ev= 0x01;
+	   snd_dtq (CanTx,req.msg);
+	   wai_flg(ev_periph, 0x01, TWF_ANDW, &flag);
+       info_piste = periph[ADDR('M')].val;
+	   numero_p= info_piste & 0x00FF;
+	   feu= info_piste & 0x8000;
+	   dly_tsk(100);
+	}
+}
+void demarrage_feu()
+{
+	while(1)
+	{
+		if(feu==0x8000)
+		{
+			sta_tsk(ID_vitesse_roue);
+		}
+	}
+}
 void main()
 {
 	ports_mcu();
@@ -230,9 +338,12 @@
 	sta_tsk(ID_periph_rx);
 	
 	sta_tsk(ID_asserv_T);
+	//sta_tsk(ID_hcy_tourelle);
 	sta_tsk(ID_dist_T);
+	sta_tsk(ID_demarrage_feu);
 	sta_tsk(ID_vitesse_roue);
 	sta_tsk(ID_info_capt);
+	sta_tsk(ID_mode_course);
 	
 
     while(1)
Index: branch/mbaye/Emb_App/conf_noyau.cfg
===================================================================
--- branch/mbaye/Emb_App/conf_noyau.cfg	(revision 389)
+++ branch/mbaye/Emb_App/conf_noyau.cfg	(revision 390)
@@ -20,7 +20,7 @@
 
 // max definition
 maxdefine{
-	max_task	= 7;
+	max_task	= 9;
 	max_flag	= 3;
 	max_dtq	= 2;
 	max_cyh	= 1;
@@ -48,7 +48,7 @@
 	name	= ID_asserv_T;
 	stack_size	= 512;
 	stack_section	= stack;
-	priority	= 9;
+	priority	= 10;
 	initial_start	= ON;
 	exinf	= 0x0;
 };
@@ -57,7 +57,7 @@
 	name	= ID_dist_T;
 	stack_size	= 512;
 	stack_section	= stack;
-	priority	= 9;
+	priority	= 10;
 	initial_start	= ON;
 	exinf	= 0x0;
 };
@@ -66,7 +66,7 @@
 	name	= ID_vitesse_roue;
 	stack_size	= 512;
 	stack_section	= stack;
-	priority	= 9;
+	priority	= 10;
 	initial_start	= ON;
 	exinf	= 0x0;
 };
@@ -75,11 +75,29 @@
 	name	= ID_info_capt;
 	stack_size	= 512;
 	stack_section	= stack;
-	priority	= 9;
+	priority	= 10;
 	initial_start	= ON;
 	exinf	= 0x0;
 };
 task[]{
+	entry_address	= mode_course();
+	name	= ID_mode_course;
+	stack_size	= 512;
+	stack_section	= stack;
+	priority	= 10;
+	initial_start	= ON;
+	exinf	= 0x0;
+};
+task[]{
+	entry_address	= demarrage_feu();
+	name	= ID_demarrage_feu;
+	stack_size	= 512;
+	stack_section	= stack;
+	priority	= 8;
+	initial_start	= ON;
+	exinf	= 0x0;
+};
+task[]{
 	entry_address	= periph_tx();
 	name	= ID_periph_tx;
 	stack_size	= 256;
