most functionality to splashdwon, find neutral and start mission. short timeouts still in code for testing, will adjust to go directly to sit_idle after splashdown

Dependencies:   mbed MODSERIAL FATFileSystem

Revision:
72:250b2665755c
Parent:
71:939d179478c4
Child:
73:f6f378311c8d
--- a/main.cpp	Fri Jun 29 21:52:31 2018 +0000
+++ b/main.cpp	Mon Jul 02 14:28:22 2018 +0000
@@ -65,16 +65,6 @@
 volatile unsigned int bTick = 0;
 volatile unsigned int timer_counter = 0;
 
-char hex[9];
-
-char * conversion(float input_float) {
-    int integer_number = lround(100.0 * input_float);      //convert floating point input to integer to broadcast over serial (reduce precision)
-    
-    memset(hex, 0, sizeof(hex) );   //  void* memset( void* dest, int ch, size_t count );   // CLEAR IT  (need null at end of string)
-    sprintf(hex, "%8x", integer_number);                                 //generates spaces 0x20
-    return hex;
-}
-
 static unsigned int read_ticker(void) {      //Basically this makes sure you're reading the data at one instance (not while it's changing)
     unsigned int val = bTick;
     if( val )
@@ -148,6 +138,7 @@
     log_loop = false;   // wait until the loop rate timer fires again
 }
 
+//single system timer to run hardware/electronics timing
 static void system_timer(void) {
     bTick = 1;
     
@@ -182,7 +173,7 @@
 
 void setup() {
     pc().baud(57600);
-    pc().printf("\n\n\r FSG PCB Bench Test V1.5)\n\n\r");
+    pc().printf("\n\n\r FSG PCB Bench Test version 1.7C)\n\n\r");
  
     // start up the system timer
     //systemTimer().start();
@@ -276,14 +267,12 @@
 int main() {
     setup();
     
-    // set up the depth sensor. This is an internal ADC read
-    wait(1.0);          //giving this time to work
-    depth().tare();   //this did not work correctly before the ADC starts
+    systemTicker.attach_us(&system_timer, 1000);         // Interrupt timer running at 0.001 seconds       (slower than original ADC time interval)
     
     unsigned int tNow = 0;
     
-    pc().baud(57600);
-    pc().printf("\n\n\r FSG PCB v1.7 (XBee) 6/25/2018 \n\n\r");
+    //pc().baud(57600);
+    pc().printf("\n\n\r FSG PCB v1.8 (XBee) 07/02/2018 \n\n\r");
     
     systemTicker.attach_us(&system_timer, 1000);         // Interrupt timer running at 0.001 seconds       (slower than original ADC time interval)
         
@@ -294,8 +283,7 @@
 
             //run finite state machine fast when transmitting data
             if (current_state == TX_MBED_LOG or current_state == RECEIVE_SEQUENCE) {
-                //if ( (tNow % 10) == 0 ) {   // 0.001 second intervals  (1000 Hz)
-                if ( (tNow % 100) == 0 ) {   // 0.1 second intervals  (10 Hz)
+                if ( (tNow % 10) == 0 ) {   // 0.01 second intervals  (100 Hz)
                     fsm_loop = true;
                     FSM();
                 }
@@ -316,4 +304,10 @@
             }
         }
     }
-}
\ No newline at end of file
+}
+
+
+
+
+
+