mbed-os github

Dependencies:   ADS1015 Faulhaber HTU21D_mod MS5837_potless Sensor_Head_RevB_3 USBDevice_dfu Utilsdfu beep

Fork of ARNSRS_testDFU by POTLESS

Revision:
87:314231bfaf8f
Parent:
85:98861c7bb3a1
Child:
88:8965483d35c9
--- a/main.cpp	Fri Sep 14 06:39:08 2018 +0000
+++ b/main.cpp	Fri Sep 14 12:20:29 2018 +0000
@@ -135,14 +135,14 @@
 
 //Paramètre du PID
 float Kc = 40;
-float Ti = 0;
+float Ti = 1;
 float Td = 0;
-float RATE_PID = 10.0;
+float RATE_PID = 1.0;
 float Commande_PID;
 int consigne = 210;
-float Max_Input = 1000;
-float Min_Input = 80;
-float Borne = 5; //ce sont des pourcentages
+float Max_Input = 1260;
+float Min_Input = 0;
+float Borne = 1; //ce sont des pourcentages
 float Max_Output = 100 - Borne;//on laisse en pourcentage et on calcule l'angle après le compute
 float Min_Output = 0 + Borne;
 
@@ -252,7 +252,7 @@
 
     //A fond et avec une erreur tolérée de +- 5 deg autour du Home. Cohérent avec le future init qui recherche une erreur > 5 deg
     Volets_Speed = 1;
-    Volet_DeadBand = 10;
+    Volet_DeadBand = 1;
 
     Consigne_poumon = HOME_SERVO_POUMON;
     Consigne_fuite = HOME_SERVO_FUITE;
@@ -574,12 +574,12 @@
             // on détermine le output comme un débit entre 0 et 100% et on fait le calcul d'angle ensuite
             // on suppose pour simplifier que le débit est proportionnel à la surface projeté du papillon sur un plan perpendiculaire à la section du tuyau
             // exemple pour 50% de débit, l'angle à ouvrir est de Acos(0.5)=60degrés 
-            float angle = 90 + acos(1-pid_output/100)*180/3.14159265f;
-            DEBUG("\r\n  pid_ouput = %f  \r\n", pid_output);
+            float angle = 90 - acos(1-pid_output/100)*180/3.14159265f;
+            //DEBUG("\r\n  pid_ouput = %f  \r\n", pid_output);
             //Nouvelle sortie servo poumon si on est pas en mode SECU
-            Consigne_fuite = angle;//;
+            Consigne_poumon = angle;//;
             // mode volets asservis (simule un seul moteur)
-            Consigne_poumon = 90 - Consigne_fuite; //control_Servo.compute();
+            Consigne_fuite = 90 - Consigne_poumon; //control_Servo.compute();
             wait(RATE_PID);
         }
     }
@@ -807,18 +807,18 @@
     } else if (0 == strcmp(com, "cons")) {
         consigne = atoi(numb);
         control_Servo.setSetPoint(consigne);
-        OUTPUT("  MAJ CONSIGNE PID -->  Consigne = %d\r\n", consigne);
+        OUTPUT("  MAJ CONSIGNE PID --  Consigne = %d\r\n", consigne);
     } else if (0 == strcmp(com, "rate")) {
         RATE_PID = atof(numb);
         //control_Servo.reset();
         control_Servo.setInterval(RATE_PID);
-        OUTPUT("  MAJ RATE PID -->  Rate = %f\r\n", RATE_PID);
+        OUTPUT("  MAJ RATE PID --  Rate = %f\r\n", RATE_PID);
     } else if (0 == strcmp(com, "bornes")) {
         Borne = atof(numb);
         Min_Output = 0 + Borne;
         Max_Output = 90 - Borne;
         control_Servo.setOutputLimits(Min_Output, Max_Output);
-        OUTPUT("  MAJ LIMITE OUTPUT PID -->  Min_Output = %f   Max_Output = %f\r\n", Min_Output, Max_Output);    
+        OUTPUT("  MAJ LIMITE OUTPUT PID --  Min_Output = %f   Max_Output = %f\r\n", Min_Output, Max_Output);    
     } else if (0 == strcmp(com, "dfu")) {
         OUTPUT("  Passage en DFU...\r\n");
         FLAG_REC = false;
@@ -856,7 +856,7 @@
 
     DEEP_DEBUG("\r\n  Commande = %s       Valeur = %s \r\n\r\n", com, numb);
 
-    OUTPUT("?\r\n");
+   // OUTPUT("?\r\n");
 
     if (0 == strcmp(com, "USB")) {
         OUTPUT("  Passage en Mode Transfert Flash To USB...\r\n");
@@ -870,7 +870,7 @@
     } else if (0 == strcmp(com, "cons")) {
         consigne = atoi(numb);
         control_Servo.setSetPoint(consigne);
-        OUTPUT("  MAJ CONSIGNE PID -->  Consigne = %d\r\n", consigne);    
+        OUTPUT("  MAJ CONSIGNE PID --  Consigne = %d\r\n", consigne);    
     } else if (0 == strcmp(com, "reset")) {
         NVIC_SystemReset();
     } else if (0 == strcmp(com, "sleep")) {