Index: branch/Styves_POUOTONG/tp_info6/Emb_App.tws
===================================================================
--- branch/Styves_POUOTONG/tp_info6/Emb_App.tws	(revision 470)
+++ branch/Styves_POUOTONG/tp_info6/Emb_App.tws	(revision 471)
@@ -12,9 +12,11 @@
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\bsp\uart0.c" 
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\crt0mr.a30" 
+"E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\Debug\mr308.inc" 
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\Debug\sys_rom.inc" 
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\programme_principal_etud.c" 
 [WORKSPACE_FILE_STATES]
+"E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\Debug\mr308.inc" 0 0 1430 351 0 7 
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\Debug\sys_rom.inc" 100 100 1430 351 0 4 
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\conf_noyau.cfg" 75 75 1430 351 0 3 
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\crt0mr.a30" 0 0 1596 539 0 1 
Index: branch/Styves_POUOTONG/tp_info6/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/Styves_POUOTONG/tp_info6/Emb_App/SessionM32C_E8a_system.hsf	(revision 470)
+++ branch/Styves_POUOTONG/tp_info6/Emb_App/SessionM32C_E8a_system.hsf	(revision 471)
@@ -141,8 +141,8 @@
 "{55384715-F881-421C-A548-D7D1ABE158E1}PDMRWndInstanceKey0" "{WK_00000001_PDMR}EmbM32C87AppSessionM32C_E8a_system" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_EVAL_DENORMAL_MODE" "0" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_EVAL_ROUND_MODE" "0" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "000000000000FFFF" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000020" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_10" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_11" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_12" "0000000000000000" 
@@ -149,12 +149,12 @@
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_13" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_14" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000512" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF3066" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF05A7" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000B2E" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000842" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "00000000000000C0" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "00000000000000C4" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000B28" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "000000000000084A" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000001" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000004005" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_21" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_22" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_23" "0000000000000000" 
@@ -171,9 +171,9 @@
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_33" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_34" "000000000000036A" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_35" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000B30" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000B36" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000B3E" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000001" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000B5C" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000512" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_8" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_9" "0000000000000000" 
@@ -205,17 +205,17 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth2" "148" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth3" "238" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH" "c,buff,n,rx,flag," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "alpha, 10, 0, P, Col, Hex, N" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "dist, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "cmd, 10, 0, P, Col, Hex, N" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "capt, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "dist, 1, 0, P, Col, Dec, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "num_piste, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "couleur_capteur, 1, 0, P, Col, Dec, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "val_capteur, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004" "capt, 1, 0, P, Col, Hex, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004" "cons_vitesse, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005" "val_capteur, 1, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005" "etat_feu, 1, 0, P, Col, Hex, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "6" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
@@ -320,9 +320,10 @@
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\programme_principal_etud.c" 
-"E:\tp_info6_2018_Styves_POUOTONG\tp_info6\bsp\periph.c" 
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\crt0mr.a30" 
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\bsp\uart0.c" 
+"E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\Debug\mr308.inc" 
+"E:\tp_info6_2018_Styves_POUOTONG\tp_info6\bsp\periph.c" 
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\bsp\periph.h" 
 "E:\tp_info6_2018_Styves_POUOTONG\tp_info6\Emb_App\Debug\sys_rom.inc" 
@@ -372,5 +373,5 @@
 [FLASH_DETAILS]
 "" 0 0 "" 0 "" 0 0 "" 0 0 0 0 0 0 0 "" "" "" "" "" 
 [BREAKPOINTS]
-"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 99411312 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 91223040 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/Styves_POUOTONG/tp_info6/Emb_App/programme_principal_etud.c
===================================================================
--- branch/Styves_POUOTONG/tp_info6/Emb_App/programme_principal_etud.c	(revision 470)
+++ branch/Styves_POUOTONG/tp_info6/Emb_App/programme_principal_etud.c	(revision 471)
@@ -155,35 +155,61 @@
 	}
 void vitesse()
 {                
-                CanFrame requete; 
-     		if(etat_feu == 0x8000){
+        CanFrame requete; 
+       requete.data.id = 'V';
+       requete.data.rtr = 0;
+	if (etat_feu == 0x8000){
+		requete.data.val=25;
+        snd_dtq(CanTx,requete.msg);
+	}
+	 while(1)
+	{
+		switch (num_piste)
+		{
+			case 0x0001:
 				cons_vitesse=25;
-				requete.data.id = 'V';
-                requete.data.rtr = 0;
-                requete.data.val=cons_vitesse;
+				requete.data.val=cons_vitesse;
+            	snd_dtq(CanTx,requete.msg);
+			break;
+			
+			case 0x0002:
+				cons_vitesse=25;
+				requete.data.val=cons_vitesse;
+            	snd_dtq(CanTx,requete.msg);
+			break;
+			
+			case 0x0003:
+			if (val_capteur == 0xC8 || val_capteur == 0x74){
+				cons_vitesse=45;
+				requete.data.val=cons_vitesse;
+              	snd_dtq(CanTx,requete.msg);
+			}
+			else if (val_capteur == 0xD8 || val_capteur == 0xD4){
+				cons_vitesse=10;
+				requete.data.val=cons_vitesse;
+         		snd_dtq(CanTx,requete.msg);
+			}
+			else {
+				cons_vitesse=25;
+				requete.data.val=cons_vitesse;
                 snd_dtq(CanTx,requete.msg);
-			}	
-
-				/*if(val_capteur == 0xC8){
-					cons_vitesse=50;
-					requete.data.id = 'V';
-                	requete.data.rtr = 0;
-                	requete.data.val=cons_vitesse;
-                	snd_dtq(CanTx,requete.msg);
-					}
-				else if(val_capteur == 0xD8 || etat_feu == 0x8000 ){
-					cons_vitesse=25;
-					requete.data.id = 'V';
-                	requete.data.rtr = 0;
-                	requete.data.val=cons_vitesse;
-                	snd_dtq(CanTx,requete.msg);
-					}*/
-			  
+			}
+			break;
+			
+			case 0x0004:
+				cons_vitesse=25;
+				requete.data.val=cons_vitesse;
+            	snd_dtq(CanTx,requete.msg);
+			break;
+		}
+		
+	}
+               dly_tsk(10); 
 }
 
-void Asserv1()                        //asservissemt de la tourelle
+void Asserv1()                        //asservissemt des roues
 {
-                CanFrame requete,req; 
+                CanFrame requete; 
                 CanFrame comm;        
 short cmd;
 short erreur;
@@ -197,50 +223,48 @@
                 
                 erreur = consigne - dist;
                 cmd = erreur*k;
-                if(/*val_capteur == 0xF4 || */val_capteur == 0xC8){
-                  
-						cons_vitesse=45;
-						requete.data.id = 'V';
-                		requete.data.rtr = 0;
-                		requete.data.val=cons_vitesse;
-                		snd_dtq(CanTx,requete.msg);
-						
-					/*	comm.data.id = 'D';
-                        comm.data.rtr = 0;                //Indique une ecriture
-                        comm.data.val = 0;
-                        snd_dtq(CanTx, comm.msg);
-						dly_tsk(45);
-						cons_vitesse=5;
-						requete.data.id = 'V';
-                		requete.data.rtr = 0;
-                		requete.data.val=cons_vitesse;
-                		snd_dtq(CanTx,requete.msg);
-						*/
-						comm.data.id = 'D';
-                        comm.data.rtr = 0;                //Indique une ecriture
-                        comm.data.val = cmd;
-                        snd_dtq(CanTx, comm.msg);
-						dly_tsk(30);
-						comm.data.val = 0;
-                        snd_dtq(CanTx, comm.msg);
-                        }
-                else if((dist < 1000 && dist > 0) /*|| val_capteur == 0x80*/ || val_capteur == 0xD4){
-      
-						cons_vitesse=25;
-						requete.data.id = 'V';
-                		requete.data.rtr = 0;
-                		requete.data.val=cons_vitesse;
-                		snd_dtq(CanTx,requete.msg);
-						
-						comm.data.id = 'D';
-                        comm.data.rtr = 0;                //Indique une ecriture
-                        comm.data.val = cmd;
-                        snd_dtq(CanTx, comm.msg);
-                        }
-        
-                dly_tsk(10);
-                }
-        }        
+
+				comm.data.id = 'D';
+                comm.data.rtr = 0;
+		
+		switch (num_piste)
+		{
+			case 0x0001:
+				comm.data.val = cmd;
+                snd_dtq(CanTx, comm.msg);
+			break;
+			
+			case 0x0002:
+			if(val_capteur == 0xF4){
+				comm.data.val = 0;
+                snd_dtq(CanTx, comm.msg);
+			}
+			else if(dist < 1500 || val_capteur == 0x80){
+				comm.data.val = cmd;
+            	snd_dtq(CanTx, comm.msg);
+			}
+			break;
+
+			case 0x0003:
+			if(dist < 1500 || val_capteur == 0xD8 || val_capteur == 0xD4){
+				comm.data.val = cmd;
+             	snd_dtq(CanTx, comm.msg);
+			}
+			else if (val_capteur == 0x74){
+				comm.data.val = 0;
+         		snd_dtq(CanTx, comm.msg);
+			}
+			break;
+			
+			case 0x0004:
+				comm.data.val = cmd;
+                snd_dtq(CanTx, comm.msg);
+			break;
+		}
+			
+	}
+		dly_tsk(10);
+}
     	
 void capteur()
 {
