Nucleo-transfer

Dependencies:   ADS1015 MPU6050 PixelArray PixelArray-Nucleo mbed WS2813

Fork of Nucleo-transfer by Momo Medical

Revision:
56:97dea631c5f2
Parent:
55:b74e7076d7a0
Child:
57:fac732476810
--- a/Sensorplate/main.cpp	Thu Feb 15 16:32:24 2018 +0000
+++ b/Sensorplate/main.cpp	Wed Feb 28 09:33:58 2018 +0000
@@ -360,16 +360,19 @@
 //            power_plug_logged = power_plug_state;
 //        }
 //    }
-
+    
     if (connection_test_sensorplate == 1) {                                                     // If statement for sending serial information sensorplate data when connection test is active.
         // Receiving order sensor information: 8 resistive sensors, 5 electric readings. Is splitted in two parts - part 1/2.
         pi_serial.printf("!,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\n", piezo_resistive_array[0], piezo_resistive_array[1], piezo_resistive_array[2], piezo_resistive_array[3], piezo_resistive_array[4], piezo_resistive_array[5], piezo_resistive_array[6], piezo_resistive_array[7], piezo_electric_array[0], piezo_electric_array[1], piezo_electric_array[2], piezo_electric_array[3], piezo_electric_array[4]); // print all to serial port
 
         if (test_mode == 1) {
-//            usb_serial.printf("!,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\n", piezo_resistive_array[0], piezo_resistive_array[1], piezo_resistive_array[2], piezo_resistive_array[3], piezo_resistive_array[4], piezo_resistive_array[5], piezo_resistive_array[6], piezo_resistive_array[7], piezo_electric_array[0], piezo_electric_array[1], piezo_electric_array[2], piezo_electric_array[3], piezo_electric_array[4]); // print all to serial port
+            usb_serial.printf("!,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\n", piezo_resistive_array[0], piezo_resistive_array[1], piezo_resistive_array[2], piezo_resistive_array[3], piezo_resistive_array[4], piezo_resistive_array[5], piezo_resistive_array[6], piezo_resistive_array[7], piezo_electric_array[0], piezo_electric_array[1], piezo_electric_array[2], piezo_electric_array[3], piezo_electric_array[4]); // print all to serial port
         }
     } else {
         pi_serial.printf("!,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\n",0,0,0,0,0,0,0,0,0,0,0,0,0);
+        if (test_mode == 1) {
+            usb_serial.printf("!,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\n",0,0,0,0,0,0,0,0,0,0,0,0,0); // print all to serial port
+        }
     }
 
 }
@@ -748,7 +751,6 @@
 
         if (connection_test_sensorplate == 1) {
             piezo_electric_array[0] = piezo_electric_adc.readADC_Differential_0_1();            // First PE readout.
-
             for (uint8_t k = 0; k < 4; ++k) {
                 piezo_resistive_array[k] =    piezo_resistive_adc1.readADC_SingleEnded(k);  // First 4 PR readout.
             }
@@ -756,7 +758,6 @@
 //                usb_serial.printf("Loop time: %d ms\n",piezo_electric_sample_timer.read_ms());
             }
             while(piezo_electric_sample_timer.read_us()<(1*(total_readout_cycle_time_us/5))) {} // Wait untill 20% of cycle. Energy efficiency is not fine in this situation, correct if low energy is needed.
-
             piezo_electric_array[1] = piezo_electric_adc.readADC_Differential_0_1();            // Second PE readout.
 
             for (uint8_t k = 0; k < 4; ++k) {
@@ -765,7 +766,6 @@
             if (test_mode == 1) {
 //                usb_serial.printf("Loop time: %d ms\n",piezo_electric_sample_timer.read_ms());
             }
-
             while(piezo_electric_sample_timer.read_us()<(2*(total_readout_cycle_time_us/5))) {} // Wait untill 40% of cycle. Energy efficiency is not fine in this situation, correct if low energy is needed.
 
             piezo_electric_array[2] = piezo_electric_adc.readADC_Differential_0_1();            // Third PE readout.