main program

Dependencies:   PQMPU9250 PQINA226 mbed PQAEGPS PQEEPROM PQADXL375 SDFileSystem PQLPS22HB PQES920LR

Files at this revision

API Documentation at this revision

Comitter:
tanahashi
Date:
Mon Mar 02 07:16:00 2020 +0000
Parent:
4:5bc218b2a974
Commit message:
fixed pinout

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 5bc218b2a974 -r 22adf1eae5e4 main.cpp
--- a/main.cpp	Wed Feb 26 07:03:52 2020 +0000
+++ b/main.cpp	Mon Mar 02 07:16:00 2020 +0000
@@ -33,8 +33,8 @@
 
 Serial pc(USBTX, USBRX, 115200);
 
-Serial es_serial(p9, p10, 115200);
-Serial gps_serial(p13, p14, 115200);
+Serial gps_serial(p9, p10, 115200);
+Serial es_serial(p13, p14, 115200);
 
 I2C i2c(p28, p27);
 
@@ -56,16 +56,18 @@
 Timer flight_timer;
 Timer sd_timer;
 
-Ticker debug_ticker;
+Ticker downlink_ticker;
 Ticker log_ticker;
-Ticker downlink_ticker;
+Ticker debug_ticker;
 
-DigitalIn liftoff_pin(p21);
-DigitalIn ems_pin(p24);
-DigitalIn flight_pin(p26);
+DigitalIn debug_pin(p17);
+DigitalIn liftoff_pin(p18);
+DigitalIn ems_pin(p19);
+DigitalIn flight_pin(p20);
 
-DigitalOut sep(p25);
-DigitalOut buzzer(p22);
+DigitalOut sep(p21);
+DigitalOut buzzer(p23);
+DigitalOut sig(p24);
 
 BusOut led(LED1, LED2, LED3, LED4);
 
@@ -263,6 +265,7 @@
         fprintf(sd, "\r\n");
     }
 
+    debug_pin.mode(PullUp);
     liftoff_pin.mode(PullDown);
     ems_pin.mode(PullDown);
     flight_pin.mode(PullUp);
@@ -890,41 +893,43 @@
 
 void debug()
 {
-    pc.printf("mission_timer_reset: %d\r\n", mission_timer_reset);
-    pc.printf("mission_time: %d\r\n", mission_time);
-    pc.printf("flight_time: %d\r\n", flight_time);
-    pc.printf("phase: %d\r\n", phase);
-    pc.printf("f_sd: %d\r\n", f_sd);
-    pc.printf("f_gps: %d\r\n", f_gps);
-    pc.printf("f_adxl: %d\r\n", f_adxl);
-    pc.printf("f_ina_in: %d\r\n", f_ina_in);
-    pc.printf("f_ina_ex: %d\r\n", f_ina_ex);
-    pc.printf("f_lps: %d\r\n", f_lps);
-    pc.printf("f_mpu: %d\r\n", f_mpu);
-    pc.printf("f_mpu_ak: %d\r\n", f_mpu_ak);
-    pc.printf("lat: %f\r\n", lat);
-    pc.printf("lon: %f\r\n", lon);
-    pc.printf("sat: %d\r\n", sat);
-    pc.printf("fix: %d\r\n", fix);
-    pc.printf("hdop: %f\r\n", hdop);
-    pc.printf("alt: %f\r\n", alt);
-    pc.printf("geoid: %f\r\n", geoid);
-    pc.printf("high_accel_x: %f\r\n", high_accel[0]);
-    pc.printf("high_accel_y: %f\r\n", high_accel[1]);
-    pc.printf("high_accel_z: %f\r\n", high_accel[2]);
-    pc.printf("voltage_in: %f\r\n", voltage_in);
-    pc.printf("current_in: %f\r\n", current_in);
-    pc.printf("voltage_ex: %f\r\n", voltage_ex);
-    pc.printf("current_ex: %f\r\n", current_ex);
-    pc.printf("press: %f\r\n", press);
-    pc.printf("temp: %f\r\n", temp);
-    pc.printf("accel_x: %f\r\n", accel[0]);
-    pc.printf("accel_y: %f\r\n", accel[1]);
-    pc.printf("accel_z: %f\r\n", accel[2]);
-    pc.printf("gyro_x: %f\r\n", gyro[0]);
-    pc.printf("gyro_y: %f\r\n", gyro[1]);
-    pc.printf("gyro_z: %f\r\n", gyro[2]);
-    pc.printf("mag_x: %f\r\n", mag[0]);
-    pc.printf("mag_y: %f\r\n", mag[1]);
-    pc.printf("mag_z: %f\r\n", mag[2]);
+    if(!debug_pin) {
+        pc.printf("mission_timer_reset: %d\r\n", mission_timer_reset);
+        pc.printf("mission_time: %d\r\n", mission_time);
+        pc.printf("flight_time: %d\r\n", flight_time);
+        pc.printf("phase: %d\r\n", phase);
+        pc.printf("f_sd: %d\r\n", f_sd);
+        pc.printf("f_gps: %d\r\n", f_gps);
+        pc.printf("f_adxl: %d\r\n", f_adxl);
+        pc.printf("f_ina_in: %d\r\n", f_ina_in);
+        pc.printf("f_ina_ex: %d\r\n", f_ina_ex);
+        pc.printf("f_lps: %d\r\n", f_lps);
+        pc.printf("f_mpu: %d\r\n", f_mpu);
+        pc.printf("f_mpu_ak: %d\r\n", f_mpu_ak);
+        pc.printf("lat: %f\r\n", lat);
+        pc.printf("lon: %f\r\n", lon);
+        pc.printf("sat: %d\r\n", sat);
+        pc.printf("fix: %d\r\n", fix);
+        pc.printf("hdop: %f\r\n", hdop);
+        pc.printf("alt: %f\r\n", alt);
+        pc.printf("geoid: %f\r\n", geoid);
+        pc.printf("high_accel_x: %f\r\n", high_accel[0]);
+        pc.printf("high_accel_y: %f\r\n", high_accel[1]);
+        pc.printf("high_accel_z: %f\r\n", high_accel[2]);
+        pc.printf("voltage_in: %f\r\n", voltage_in);
+        pc.printf("current_in: %f\r\n", current_in);
+        pc.printf("voltage_ex: %f\r\n", voltage_ex);
+        pc.printf("current_ex: %f\r\n", current_ex);
+        pc.printf("press: %f\r\n", press);
+        pc.printf("temp: %f\r\n", temp);
+        pc.printf("accel_x: %f\r\n", accel[0]);
+        pc.printf("accel_y: %f\r\n", accel[1]);
+        pc.printf("accel_z: %f\r\n", accel[2]);
+        pc.printf("gyro_x: %f\r\n", gyro[0]);
+        pc.printf("gyro_y: %f\r\n", gyro[1]);
+        pc.printf("gyro_z: %f\r\n", gyro[2]);
+        pc.printf("mag_x: %f\r\n", mag[0]);
+        pc.printf("mag_y: %f\r\n", mag[1]);
+        pc.printf("mag_z: %f\r\n", mag[2]);
+    }
 }
\ No newline at end of file