2nd Library

Files at this revision

API Documentation at this revision

Comitter:
altb2
Date:
Tue Apr 27 07:49:53 2021 +0000
Parent:
3:e3b84ea63c0f
Commit message:
.

Changed in this revision

GPA.cpp Show annotated file Show diff for this revision Revisions of this file
GPA.h Show annotated file Show diff for this revision Revisions of this file
--- a/GPA.cpp	Thu Apr 01 13:38:43 2021 +0000
+++ b/GPA.cpp	Tue Apr 27 07:49:53 2021 +0000
@@ -171,6 +171,9 @@
     int NmeasMin = (int)ceil(1.0f/Ts);
     int Nstart = (int)ceil(3.0f/Ts);
     int Nsweep = (int)ceil(0.0f/Ts);
+    new_data_available = false;
+    meas_is_finished = false;
+    start_now = false;
 
     setParameters(fMin, fMax, NfexcDes, NperMin, NmeasMin, Ts, Aexc0, Aexc1, Nstart, Nsweep, doPrint);
 }
@@ -178,12 +181,18 @@
 GPA::GPA(float fMin, float fMax, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep)
 {
     doPrint = true;
+    new_data_available = false;
+    meas_is_finished = false;
+    start_now = false;
     setParameters(fMin, fMax, NfexcDes, NperMin, NmeasMin, Ts, Aexc0, Aexc1, Nstart, Nsweep, doPrint);
 }
 
 GPA::GPA(float f0, float f1, float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1, int Nstart, int Nsweep)
 {
     doPrint = true;
+    new_data_available = false;
+    meas_is_finished = false;
+
     assignParameters(NfexcDes, NperMin, NmeasMin, Ts, Nstart, Nsweep);
 
     // convert fexcDes from float to float, it is assumed that it is sorted
@@ -291,15 +300,19 @@
         // user info
         if(i == 1 && doPrint) {
             printLine();
-            printf("  fexc[Hz]    |Gyu|    deg(Gyu)  |Gyr|    deg(Gyr)   |U|       |Y|       |R|\r\n");
+            //printf("  fexc[Hz]    |Gyu|    deg(Gyu)  |Gyr|    deg(Gyr)   |U|       |Y|       |R|\r\n");
             printLine();
+            start_now = true;
+            //uart_com.send_char_data(250,2,0);
         }
+        
         // get a new unique frequency point
         while(fexc == fexcPast) {
             // measurement finished
             if(i > NfexcDes) {
                 gpaData.MeasPointFinished = false;
                 gpaData.MeasFinished = true;
+                meas_is_finished = true;
                 return 0.0f;
             }
             calcGPAmeasPara(fexcDes[i - 1]);
@@ -372,7 +385,8 @@
         gpaData.ind++;
         // user info
         if(doPrint) {
-            printf("%11.4e %9.3e %8.3f %9.3e %8.3f %9.3e %9.3e %9.3e\r\n", gpaData.fexc, gpaData.absGyu, gpaData.angGyu, gpaData.absGyr, gpaData.angGyr, gpaData.Umag, gpaData.Ymag, gpaData.Rmag);
+            //printf("%11.4e %9.3e %8.3f %9.3e %8.3f %9.3e %9.3e %9.3e\r\n", gpaData.fexc, gpaData.absGyu, gpaData.angGyu, gpaData.absGyr, gpaData.angGyr, gpaData.Umag, gpaData.Ymag, gpaData.Rmag);
+            new_data_available = true;
         }
         i += 1;
         j = 1;
@@ -459,7 +473,7 @@
 
 void GPA::printLongLine()
 {
-    printf("-------------------------------------------------------------------------------------------------------------------------------\r\n");
+    //printf("-------------------------------------------------------------------------------------------------------------------------------\r\n");
 }
 
 // -----------------------------------------------------------------------------
@@ -520,7 +534,15 @@
     printf("--------------------------------------------------------------------------------\r\n");
 }
 
-GPA::gpadata_t GPA::getGPAdata()
+void GPA::getGPAdata(float *val)
 {
-    return gpaData;
+    val[0] = gpaData.fexc;
+    val[1] = gpaData.absGyu;
+    val[2] = gpaData.angGyu;
+    val[3] = gpaData.absGyr;
+    val[4] = gpaData.angGyr;
+    val[5] = gpaData.Umag;
+    val[6] = gpaData.Ymag;
+    val[7] = gpaData.Rmag;
+    new_data_available = false;
 }
\ No newline at end of file
--- a/GPA.h	Thu Apr 01 13:38:43 2021 +0000
+++ b/GPA.h	Tue Apr 27 07:49:53 2021 +0000
@@ -1,5 +1,8 @@
 #ifndef GPA_H_
 #define GPA_H_
+#include "uart_comm_thread.h"
+
+
 
 class GPA
 {
@@ -44,7 +47,10 @@
     void    printLine();
     void    printLongLine();
 
-    gpadata_t getGPAdata();
+    void    getGPAdata(float *);
+    bool    new_data_available;
+    bool    meas_is_finished;
+    bool    start_now;
 
 private: