mbed-os github

Dependencies:   ADS1015 Faulhaber HTU21D_mod MS5837_potless Sensor_Head_RevB_3 USBDevice_dfu Utilsdfu beep

Fork of ARNSRS_testDFU by POTLESS

Files at this revision

API Documentation at this revision

Comitter:
POTLESS_2
Date:
Mon Sep 10 09:33:38 2018 +0000
Parent:
83:855eb58c017d
Child:
85:98861c7bb3a1
Child:
86:02e83a215e4e
Commit message:
ajout de commandes reset PID, changement des output limit

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Sep 05 09:20:10 2018 +0000
+++ b/main.cpp	Mon Sep 10 09:33:38 2018 +0000
@@ -142,8 +142,9 @@
 int consigne = 210;
 float Max_Input = 1000;
 float Min_Input = 80;
-float Max_Output = 85;//Vérifier la valeur pour angle à laisser ouvert...
-float Min_Output = 5;
+float Borne = 5;
+float Max_Output = 90 - Borne;//Vérifier la valeur pour angle à laisser ouvert...
+float Min_Output = 0 + Borne;
 
 //Init PID
 PID control_Servo(Kc, Ti, Td, RATE_PID);
@@ -779,19 +780,22 @@
         OUTPUT("  Reset de l'appareil.\r\n");
         wait(1);
         NVIC_SystemReset();
+    } else if (0 == strcmp(com, "pid_r")) {
+        control_Servo.reset();
+        OUTPUT("  RESET PID\r\n");    
     } else if (0 == strcmp(com, "kc")) {
         Kc = atof(numb);
-        control_Servo.reset();
+        //control_Servo.reset();
         control_Servo.setTunings(Kc, Ti, Td);
         OUTPUT("  MAJ PID -->  Kc = %f   Ti = %f   Td = %f\r\n", Kc, Ti, Td);
     } else if (0 == strcmp(com, "ti")) {
         Ti = atof(numb);
-        control_Servo.reset();
+        //control_Servo.reset();
         control_Servo.setTunings(Kc, Ti, Td);
         OUTPUT("  MAJ PID -->  Kc = %f   Ti = %f   Td = %f\r\n", Kc, Ti, Td);
     } else if (0 == strcmp(com, "td")) {
         Td = atof(numb);
-        control_Servo.reset();
+        //control_Servo.reset();
         control_Servo.setTunings(Kc, Ti, Td);
         OUTPUT("  MAJ PID -->  Kc = %f   Ti = %f   Td = %f\r\n", Kc, Ti, Td);
     } else if (0 == strcmp(com, "cons")) {
@@ -800,9 +804,15 @@
         OUTPUT("  MAJ CONSIGNE PID -->  Consigne = %d\r\n", consigne);
     } else if (0 == strcmp(com, "rate")) {
         RATE_PID = atof(numb);
-        control_Servo.reset();
+        //control_Servo.reset();
         control_Servo.setInterval(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);    
     } else if (0 == strcmp(com, "dfu")) {
         OUTPUT("  Passage en DFU...\r\n");
         FLAG_REC = false;
@@ -1106,13 +1116,13 @@
             Traceur_Arduino();
         }
 
-
         //Enregistrement de la chaine
         if (FLAG_REC) {
             UTILS::Write_Flash_File(to_store, Log_File_Name);
             count ++;
             if (count > Max_Log_Size) {
-                Create_File_Name_Date();
+                Create_File_Name_Index();
+                //Create_File_Name_Date();
                 sensors.Create_Header(Log_File_Name);
                 count = 0;
                 OUTPUT("$\r\n");