Working code for pc app 12/01/2018 commit

Dependencies:   mbed MS5607 mbed-dsp

Fork of Turrentine_Code by Alex Stokoe

Revision:
7:1a4bbff83b4d
Parent:
5:44cfc3e81d1c
Child:
8:206c2ae7f49f
--- a/main.cpp	Thu Jan 25 13:25:08 2018 +0000
+++ b/main.cpp	Tue Feb 13 14:18:08 2018 +0000
@@ -60,16 +60,16 @@
     printf("Start loop\n");
     int iter_counter = 0; //Iteration counter
     iter_timer.start();
-
+    float temperature_raw = pressure_sensor.getRawTemperature();
     printf("fsmpl titer mean_press fmax sum_peak    t90\n");
 
     //program loop    
     while(1) {
+        temperature_raw = pressure_sensor.getRawTemperature();
+        
         sample_timer.reset();
         sample_timer.start();
         
-        float temperature_raw = pressure_sensor.getRawTemperature();
-        
         //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 +77,15 @@
         }
         
         sample_timer.stop();
-        
+        /*
+        //Output raw data
+        printf("$RAW\n");
+        for(int i = 0; i < N_SAMPLES; i++) {
+            printf("$%f\n", p_data_raw[i]);
+            //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
         //
@@ -94,10 +102,6 @@
         mag_data[0] = f_data[0];
         mag_data[N_SAMPLES / 2] = f_data[1];
         
-        //Output raw data
-        /*for(int i = 0; i < N_SAMPLES; i++) {
-            printf("%f %f\n", p_data_raw[i], f_data[i]);
-        }*/
         
         
         //Find peak in spectrum
@@ -130,7 +134,7 @@
         
         //Output iteration data
         iter_counter++;
-        printf("%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 %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);
         
         //Set LEDs based on thresholds
         for(int i = 0; i < N_LEDS; i++) {