Flying Sea Glider / Mbed 2 deprecated 2019_13sep_jcw_nosd

Dependencies:   mbed MODSERIAL FATFileSystem

Revision:
99:9d0849f5fcd7
Parent:
87:6d95f853dab3
Child:
100:a21bb2e4493d
diff -r 81db9332212d -r 9d0849f5fcd7 SequenceController/SequenceController.cpp
--- a/SequenceController/SequenceController.cpp	Mon May 20 18:57:23 2019 +0000
+++ b/SequenceController/SequenceController.cpp	Fri Jun 28 13:59:11 2019 +0000
@@ -7,7 +7,7 @@
 
 void SequenceController::loadSequence() {
     xbee().printf("\n\rLoading Dive Sequence File:");
-    
+    wait(2);
     ConfigFile read_sequence_cfg;
     char value[256];
     char bux2[256];   
@@ -27,7 +27,7 @@
         
             if (read_sequence_cfg.getValue(buf, &value[0], sizeof(value))) {
                 xbee().printf("\n\rsequence %d = %s",i,value);
-                
+                xbee().printf("stuff");
                 sequenceStructLoaded[i] = process(value); //create the structs using process(string randomstring)
             }
             
@@ -99,6 +99,7 @@
     }    
     /* DEPTH TO FLOAT */
     
+    
     /* PITCH TO FLOAT */
     if ((signed int) randomstring.find("pitch") != -1) {
         if (randomstring.find("neutral") || randomstring.find("dive")) {
@@ -309,9 +310,9 @@
     
     /*  max DEPTH TO  cycle to */
  
-    if ((signed int) randomstring.find("max_depth") != -1) {
+    if ((signed int) randomstring.find("max_d") != -1) {
 
-        int depth_pos = randomstring.find("max_depth") + 10;     //11 in example literally "depth="
+        int depth_pos = randomstring.find("max_d") + 6;     //11 in example literally "depth="
         char depth_array[256] = {0};    //clear memory
         int depth_counter = 0;
         for (int i = depth_pos; i < randomstring.length(); i++) {
@@ -325,15 +326,15 @@
             }
         }
         loadStruct.max_depth = atof(depth_array);
-        sprintf(bux2, "\n\r process legfile: key=max_depth val=%g  process(legstring)count=%d \n", atof(depth_array), callcount);
+        sprintf(bux2, "\n\r process legfile: key=max_d val=%g  process(legstring)count=%d \n", atof(depth_array), callcount);
         mbedLogger().appendDiagFile(bux2,3);
 
     }
     
  
-    if ((signed int) randomstring.find("min_depth") != -1) {
+    if ((signed int) randomstring.find("min_d") != -1) {
 
-        int depth_pos = randomstring.find("min_depth") + 10;     //11 in example literally "depth="
+        int depth_pos = randomstring.find("min_d") + 6;     //11 in example literally "depth="
         char depth_array[256] = {0};    //clear memory
         int depth_counter = 0;
         for (int i = depth_pos; i < randomstring.length(); i++) {
@@ -347,27 +348,121 @@
             }
         }
         loadStruct.min_depth = atof(depth_array);
-        sprintf(bux2, "\n\r process legfile: key=min_depth val=%g \n", atof(depth_array));
+        sprintf(bux2, "\n\r process legfile: key=min_d val=%g \n", atof(depth_array));
         mbedLogger().appendDiagFile(bux2,3);
 
     }
-    if ((signed int) randomstring.find("heading") != -1) {
+    
+    /* Buoyancy Engine Offset on Dive */
+    if ((signed int) randomstring.find("BCE_dive") != -1) {
+            
+        int BCE_dive_offset_pos = randomstring.find("BCE_dive") + 9 ;     //11 in example literally "BCE_dive_offset="
+        char BCE_dive_offset_array[256] = {0};    //clear memory
+        int BCE_dive_offset_counter = 0;
+        for (int i = BCE_dive_offset_pos; i < randomstring.length(); i++) {
+            if (cstr[i] == ',')
+                break;
+            else if (cstr[i] == ';')
+                break;
+            else {
+                BCE_dive_offset_array[BCE_dive_offset_counter] = cstr[i];
+                BCE_dive_offset_counter++;
+            }
+        }
+        loadStruct.BCE_dive_offset = atof(BCE_dive_offset_array);
+        sprintf(bux2, "\n\r process legfile: key=BCE_dive val=%g \n", atof(BCE_dive_offset_array));
+        mbedLogger().appendDiagFile(bux2,3);
+    }
+        
+     /* Buoyancy Engine Offset on Dive */
+     
+     /* Battery Mass Mover Offset on Dive */
+    if ((signed int) randomstring.find("BMM_dive") != -1) {
+            
+        int BMM_dive_offset_pos = randomstring.find("BMM_dive") + 9 ;     //11 in example literally "BMM_dive_offset="
+        char BMM_dive_offset_array[256] = {0};    //clear memory
+        int BMM_dive_offset_counter = 0;
+        for (int i = BMM_dive_offset_pos; i < randomstring.length(); i++) {
+            if (cstr[i] == ',')
+                break;
+            else if (cstr[i] == ';')
+                break;
+            else {
+                BMM_dive_offset_array[BMM_dive_offset_counter] = cstr[i];
+                BMM_dive_offset_counter++;
+            }
+        }
+        loadStruct.BMM_dive_offset = atof(BMM_dive_offset_array);
+        sprintf(bux2, "\n\r process legfile: key=BMM_dive val=%g \n", atof(BMM_dive_offset_array));
+        mbedLogger().appendDiagFile(bux2,3);
+    }
         
-            int depth_pos = randomstring.find("heading") + 8;     //11 in example literally "depth="
-            char depth_array[256] = {0};    //clear memory
-            int depth_counter = 0;
-            for (int i = depth_pos; i < randomstring.length(); i++) {
+     /* Battery Mass Mover Offset on Dive */
+     
+     /* Buoyancy Engine Offset on Rise */
+    if ((signed int) randomstring.find("BCE_rise") != -1) {
+            
+        int BCE_rise_offset_pos = randomstring.find("BCE_rise") + 9 ;     //11 in example literally "BCE_rise_offset="
+        char BCE_rise_offset_array[256] = {0};    //clear memory
+        int BCE_rise_offset_counter = 0;
+        for (int i = BCE_rise_offset_pos; i < randomstring.length(); i++) {
+            if (cstr[i] == ',')
+                break;
+            else if (cstr[i] == ';')
+                break;
+            else {
+                BCE_rise_offset_array[BCE_rise_offset_counter] = cstr[i];
+                BCE_rise_offset_counter++;
+            }
+        }
+        loadStruct.BCE_rise_offset = atof(BCE_rise_offset_array);
+        sprintf(bux2, "\n\r process legfile: key=BCE_rise val=%g \n", atof(BCE_rise_offset_array));
+        mbedLogger().appendDiagFile(bux2,3);
+    }
+        
+     /* Buoyancy Engine Offset on Rise */
+     
+     /* Battery Mass Mover Offset on Rise */
+    if ((signed int) randomstring.find("BMM_rise") != -1) {
+            
+        int BMM_rise_offset_pos = randomstring.find("BMM_rise") + 9 ;     //11 in example literally "BMM_rise_offset="
+        char BMM_rise_offset_array[256] = {0};    //clear memory
+        int BMM_rise_offset_counter = 0;
+        for (int i = BMM_rise_offset_pos; i < randomstring.length(); i++) {
+            if (cstr[i] == ',')
+                break;
+            else if (cstr[i] == ';')
+                break;
+            else {
+                BMM_rise_offset_array[BMM_rise_offset_counter] = cstr[i];
+                BMM_rise_offset_counter++;
+            }
+        }
+        loadStruct.BMM_rise_offset = atof(BMM_rise_offset_array);
+        sprintf(bux2, "\n\r process legfile: key=BMM_rise val=%g \n", atof(BMM_rise_offset_array));
+        mbedLogger().appendDiagFile(bux2,3);
+    }
+        
+     /* Battery Mass Mover Offset on Rise */
+    
+    
+    if ((signed int) randomstring.find("head") != -1) {
+        
+            int heading_pos = randomstring.find("head") + 5;     //11 in example literally "depth="
+            char heading_array[256] = {0};    //clear memory
+            int heading_counter = 0;
+            for (int i = heading_pos; i < randomstring.length(); i++) {
                 if (cstr[i] == ',')
                     break;
                 else if (cstr[i] == ';')
                     break;
                 else {
-                    depth_array[depth_counter] = cstr[i];
-                    depth_counter++;
+                    heading_array[heading_counter] = cstr[i];
+                    heading_counter++;
                 }
             }
-            loadStruct.heading = atof(depth_array);
-            sprintf(bux2, "\n\r process legfile: key=heading val=%g \n", atof(depth_array));
+            loadStruct.heading = atof(heading_array);
+            sprintf(bux2, "\n\r process legfile: key=head val=%g \n", atof(heading_array));
             mbedLogger().appendDiagFile(bux2,3);
         
     }