       if (inputYAW >= inputYAWprev + 300){
         inputYAW = inputYAWprev + 300;
       }
+      if (inputYAW <= inputYAWprev - 300){
+        inputYAW = inputYAWprev - 300;
+      }
       chrono_start4 = 0;
     }
   }
 }
 
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//PID controller
+//Controleur PID
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 void pid_compute() {
   unsigned long maintenant = millis();
   int deltaTemps = (maintenant - dernierTemps);
   //if(deltaTemps >= dt){
-    
+
     //ROLL calculations
     //definition du setpoint
     pid_roll_setpoint = 0;
     if (inputROLL > THROTTLE_RMID + 10)pid_roll_setpoint = (inputROLL - THROTTLE_RMID + 10)/3.0;
     else if (inputROLL < THROTTLE_RMID - 10)pid_roll_setpoint = (inputROLL - THROTTLE_RMID - 10)/3.0;
-    
+
     roll_error = roll_speed - pid_roll_setpoint;
-  
+
     Proportional_roll = ROLL_PID_KP * roll_error;
     Integral_roll += (ROLL_PID_KI ) * roll_error;
     if (Integral_roll > ROLL_PID_MAX)Integral_roll = ROLL_PID_MAX;
     else if (Integral_roll < ROLL_PID_MIN)Integral_roll = ROLL_PID_MIN;
     Derivative_roll = ROLL_PID_KD * (roll_error - last_roll_error);
-  
+
     pid_roll_out = Proportional_roll + Integral_roll + Derivative_roll;
     if (pid_roll_out > ROLL_PID_MAX)pid_roll_out = ROLL_PID_MAX;
     else if (pid_roll_out < ROLL_PID_MIN)pid_roll_out = ROLL_PID_MIN;
-  
+
     last_roll_error = roll_error;
-  
-  
+
+
     //PITCH calculations
     //definition du setpoint
     pid_pitch_setpoint = 0;
     if (inputPITCH > THROTTLE_RMID + 10)pid_pitch_setpoint = (inputPITCH - THROTTLE_RMID + 10)/3.0;
     else if (inputPITCH< THROTTLE_RMID - 10)pid_pitch_setpoint = (inputPITCH - THROTTLE_RMID - 10)/3.0;
-    
+
     pitch_error = pitch_speed - pid_pitch_setpoint;
-  
+
     Proportional_pitch = PITCH_PID_KP * pitch_error;
     Integral_pitch += PITCH_PID_KI * pitch_error;
     if (Integral_pitch > PITCH_PID_MAX)Integral_pitch = PITCH_PID_MAX;
     else if (Integral_pitch < PITCH_PID_MIN)Integral_pitch = PITCH_PID_MIN;
     Derivative_pitch = PITCH_PID_KD * (pitch_error - last_pitch_error);
-  
+
     pid_pitch_out = Proportional_pitch + Integral_pitch + Derivative_pitch;
     if (pid_pitch_out > PITCH_PID_MAX)pid_pitch_out = PITCH_PID_MAX;
     else if (pid_pitch_out < PITCH_PID_MIN)pid_pitch_out = PITCH_PID_MIN;
-  
+
     last_pitch_error = pitch_error;
-  
+
     //YAW calculations
     //On calcule le setpoint du yaw ici car il est le meme en stabilise ou en acro
     pid_yaw_setpoint = 0;
     if (inputYAW > THROTTLE_RMID + 10)pid_yaw_setpoint = (inputYAW - THROTTLE_RMID + 10) / 3.0;
     else if (inputYAW < THROTTLE_RMID - 10)pid_yaw_setpoint = (inputYAW - THROTTLE_RMID - 10) / 3.0;
-  
+
     yaw_error = yaw_speed - pid_yaw_setpoint;
-  
+
     Proportional_yaw = YAW_PID_KP * yaw_error;
     Integral_yaw += YAW_PID_KI * yaw_error;
     if (Integral_yaw > YAW_PID_MAX)Integral_yaw = YAW_PID_MAX;
     else if (Integral_yaw < YAW_PID_MIN)Integral_yaw = YAW_PID_MIN;
     Derivative_yaw = YAW_PID_KD * (yaw_error - last_yaw_error);
-  
+
     pid_yaw_out = Proportional_yaw + Integral_yaw + Derivative_yaw;
     if (pid_yaw_out > YAW_PID_MAX)pid_yaw_out = YAW_PID_MAX;
     else if (pid_yaw_out < YAW_PID_MIN)pid_yaw_out = YAW_PID_MIN;
-  
+
     last_yaw_error = yaw_error;
 
     //dernierTemps = maintenant;
   //}
-  
+
 }
 void pid_LEVEL_compute() {
 
-  //ROLL calculations
+  //ROLL calculs
   //definition du setpoint angle
   pid_roll_setpoint = 0;
   if (inputROLL > THROTTLE_RMID + 10)pid_roll_setpoint = inputROLL - THROTTLE_RMID + 10;
   else if (inputROLL < THROTTLE_RMID - 10)pid_roll_setpoint = inputROLL - THROTTLE_RMID - 10;
-  pid_roll_setpoint -= roll_angle_adjust;            //On soustrait roll adjust pour que le setpoint soit change avec langle 
+  pid_roll_setpoint -= roll_angle_adjust;            //On soustrait roll adjust pour que le setpoint soit change avec langle
   pid_roll_setpoint /= 2;
-  
+
   roll_error = roll_speed - pid_roll_setpoint;
 
   Proportional_roll = ROLL_PID_LEVEL_KP * roll_error;

      if (inputTHROTTLE >= inputTHROTTLEprev + 300){
        inputTHROTTLE = inputTHROTTLEprev + 300;
      }
      chrono_start3 = 0;
    }
  }

  roll_angle = -1 * euler.z();
  pitch_angle = -1 * euler.y();
  yaw_angle = euler.x();

  //maintenant = 0;
  roll_angle_adjust = roll_angle * -15;  //la constante multipliee est a ajuster
  pitch_angle_adjust = pitch_angle * -15;//selon l'angle maximal que l'on veut

  //PID
