altb_pmic / Mbed 2 deprecated Test_optical_flow_PX4

Dependencies:   mbed

Revision:
9:be40afb750d3
Parent:
3:e03714326b83
Child:
11:d367224f2194
--- a/PX4Flow.h	Fri Sep 06 09:32:37 2019 +0000
+++ b/PX4Flow.h	Fri Sep 13 10:43:57 2019 +0000
@@ -39,6 +39,7 @@
 #define    GYRO_TEMPERATURE 22
 #define    QUALITY_INTEGRAL 24
 
+// valid with original and modified firmware, but different scaling with modified firmware, see Git-branch IndNav of the Firmware itselt, pmic 12.09.2019
 typedef struct i2c_frame {
     uint16_t frame_count;       // counts created I2C frames 0
     int16_t pixel_flow_x_sum;   // accumulated x flow in pixels*10 since last I2C frame 2
@@ -54,6 +55,7 @@
     int16_t ground_distance;    // Ground distance in meters*1000. Positive value: distance known. Negative value: Unknown distance 20
 } i2c_frame;
 
+// only valid with original firmware, pmic 12.09.2019
 typedef struct i2c_integral_frame {
     uint16_t frame_count_since_last_readout; // number of flow measurements since last I2C readout [#frames] 22
     int16_t pixel_flow_x_integral;           // accumulated flow in radians*10000 around x axis since last I2C readout [rad*10000] 24
@@ -82,7 +84,7 @@
     bool update();
     bool update_integral();
 
-    // Simple frame
+    // Simple frame, valid with original and modified firmware, but different scaling with modified firmware, see Git-branch IndNav of the Firmware itselt, pmic 12.09.2019
     uint16_t frame_count();
     int16_t pixel_flow_x_sum();
     int16_t pixel_flow_y_sum();
@@ -96,7 +98,7 @@
     uint8_t sonar_timestamp();
     int16_t ground_distance();
 
-    // Integral frame
+    // Integral frame, only valid with original firmware, pmic 12.09.2019
     uint16_t frame_count_since_last_readout();
     int16_t  pixel_flow_x_integral();
     int16_t  pixel_flow_y_integral();
@@ -109,10 +111,24 @@
     int16_t  gyro_temperature();
     uint8_t  quality_integral();
 
+    /* IndNav Git-branch modifications, start here */
+    // Integral frame, only valid with modified firmware, see Git-branch IndNav of the Firmware itselt, pmic 12.09.2019
+    float avg_flowx();              // avg flow x in mm/s
+    float avg_flowy();              // avg flow y in mm/s
+    uint8_t valid_frame_count();    // nr. of valid frames (qual > 0) between i2c readings
+    uint8_t all_frame_count();      // nr. of frames between i2c readings
+    float update_fs();              // i2c averaging update rate in Hz
+    float readout_fs();             // i2c readout update rate in Hz
+    uint8_t avg_quality();          // avg 0-255 linear quality measurement 0=bad, 255=best
+    float int_timespan();           // integration timespan in ms, now you can integrate flow values, if valid...
+    float avg_gyro_x();             // avg gyro x in rad/s
+    float avg_gyro_y();             // avg gyro y in rad/s
+    float avg_gyro_z();             // avg gyro z in rad/s
+    uint8_t avg_scaled_quality();   // avg 0-255 linear quality measurement 0=bad, 255=best, scaled with N_valid/N_frames
+    /* IndNav Git-branch modifications, end here */
 
 protected:
     I2C i2c;
-    Serial pc;
     
     // Buffer to read in the sensordata
     char bufferS[22];