Fork de Timer après le match à 61 points

Dependencies:   RoboClaw mbed

Fork of Timer by ARES

Revision:
78:c28bdbf29b6e
Parent:
77:f19cc7f81f2a
Child:
79:b11b50108ae5
--- a/main.cpp	Thu May 05 08:46:08 2016 +0000
+++ b/main.cpp	Thu May 05 13:17:00 2016 +0000
@@ -50,8 +50,12 @@
 Odometry odo(61.7, 61.8, ENTRAXE, 4096, roboclaw);
 
 int SIMON_i = 0, SIMON_state = 0, SCouleur = VERT, SStart = 0, SSchema = 1;
-bool SIMON_EL = false, SIMON_EZ = false, SIMON_ER = false, SGauche = false, SDevant = false, SDroite = false;
-bool Sharps_actives = true; bool SHomologation = false;
+bool SIMON_EL = false, SIMON_EZ = false, SIMON_ER = false;
+int SGauche = false, SDevant = false, SDroite = false;
+bool Sharps_actives = false;
+bool SHomologation = false;
+
+float seuils[3] = {0.25, 0.40, 0.25};
 
 void init(void);
 void update_main(void);
@@ -69,18 +73,27 @@
     wait_ms(100);
     while(START==0);
     odo.GotoXY(1000, 1000);*/
+    
+    roboclaw.ResetEnc();
+    roboclaw.ForwardM1(0);
+    roboclaw.ForwardM2(0);
+    logger.printf("Depart");
     odo.setPos(110,850,0);
+    
     init_interrupt();
+    
     while(START==0);
+    
+    logger.printf("Depart");
     odo.GotoXY(450,850);
+    logger.printf("Premier point atteint");
     odo.GotoXY(1050,1100);
-    odo.GotoXY(700,1100);
-    SHomologation = true;
-    odo.GotoXY(250,850);
-    odo.GotoXY(250,400);
-    odo.GotoXY(800,400);
-    odo.GotoXY(800,800);
-    
+    Sharps_actives = true;
+    logger.printf("Second point atteint");
+    odo.GotoXY(400,850);
+    logger.printf("Troisieme point atteint");
+    odo.GotoXY(400,1000);
+
     LEDV = 1;
     while(1);
     //homologation();
@@ -111,7 +124,6 @@
     logger.printf("Hello from main !\n\r");
 
     init_interrupt();
-    goHome();
 
     SCouleur = VERT;
     LEDV = 1;
@@ -123,15 +135,25 @@
     roboclaw.ForwardM2(0);
     wait_ms(500);
     while(1);
-    //depart();
+    /*depart();
     init_interrupt();
     wait_ms(100);
     while(START==0);
-    logger.printf("End init\n\r");
+    logger.printf("End init\n\r");*/
 }
 
 void update_main(void)
 {
     odo.update_odo();
+    
     checkAround();
+    
+    if (Sharps_actives && max(SGauche,SDevant,SDroite)>0 && odo.getCurrentStep() != STEP_T)
+    {
+        odo.pause();
+    }
+    /*else
+    {
+        odo.resume();
+    }*/
 }
\ No newline at end of file