Working code for pc app 12/01/2018 commit

Dependencies:   mbed MS5607 mbed-dsp

Fork of Turrentine_Code by Alex Stokoe

Files at this revision

API Documentation at this revision

Comitter:
AlexStokoe
Date:
Tue Feb 13 18:08:53 2018 +0000
Parent:
7:1a4bbff83b4d
Child:
9:28366bbbb13a
Commit message:
Code to work with new software, pc logging capability

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Feb 13 14:18:08 2018 +0000
+++ b/main.cpp	Tue Feb 13 18:08:53 2018 +0000
@@ -62,14 +62,19 @@
     iter_timer.start();
     float temperature_raw = pressure_sensor.getRawTemperature();
     printf("fsmpl titer mean_press fmax sum_peak    t90\n");
-
+    int a = 0;
     //program loop    
     while(1) {
         temperature_raw = pressure_sensor.getRawTemperature();
         
+        while (a<2000){
+            pressure_sensor.getRawPressure();
+            a++;
+            }
+        a = 0;
         sample_timer.reset();
         sample_timer.start();
-        
+            
         //Capture raw pressure samples
         for(int i = 0; i < N_SAMPLES; i++) {
             p_data_raw[i] = pressure_sensor.calculatePressure(pressure_sensor.getRawPressure(), temperature_raw);
@@ -77,7 +82,7 @@
         }
         
         sample_timer.stop();
-        /*
+        
         //Output raw data
         printf("$RAW\n");
         for(int i = 0; i < N_SAMPLES; i++) {
@@ -85,7 +90,7 @@
             //pressure_sensor.calculatePressure(pressure_sensor.getRawPressure(), temperature_raw);
         }
         printf("$ENDRAW\n");
-        */
+        
         //http://www.keil.com/pack/doc/CMSIS/DSP/html/group__RealFFT.html
         //Compute the RFFT
         //
@@ -134,7 +139,7 @@
         
         //Output iteration data
         iter_counter++;
-        printf("$DATA %5d %5d %10.0f %4d %10.5e %4.1f\n", 1000000 / (sample_timer.read_us() / N_SAMPLES), iter_timer.read_ms() / iter_counter, f_data[0] / N_SAMPLES, max_mag_i, sum, t90);
+        printf("$DATA %.2f,%.2f,%.1f,%.1f,%1.5e,%.1f\n", iter_timer.read(), 1000000 / (sample_timer.read_us() / N_SAMPLES), f_data[0] / N_SAMPLES, max_mag_i, sum, t90);
         
         //Set LEDs based on thresholds
         for(int i = 0; i < N_LEDS; i++) {