GPS working with LoRa code - can't transmit faster that once every 6 seconds

Dependencies:   mbed LoRaWAN-lib_gps_lora SingleFrequencyLora

Revision:
7:1c90f51096fe
Parent:
6:670ff1507ff4
Child:
9:b866f1bc8fd4
--- a/l86.cpp	Mon Nov 13 15:44:11 2017 +0000
+++ b/l86.cpp	Mon Nov 13 18:37:05 2017 +0000
@@ -1,18 +1,26 @@
 #include "l86.hpp"
 #include <string.h>
 #include <stdio.h>
+#include "mbed.h"
 
-void Parse_RMC_data(RMC_data *RMC_data_parse){
+#ifdef DEBUGGER
+RawSerial pc2(PC_TX, PC_RX);    // USART2
+#endif
+
+RMC_data Parse_RMC_data(char RMC_sentence[MAX_NMEA_LENGTH]){
     
     //Local Variables
     char RMC_message_copy[MAX_NMEA_LENGTH] = "";
     const char delimeter[2] = ",";
     char *token = "";
     int i = 0;
-    char temp[13][12];          /* [13][12]: 13 strings, of length 12 */
+    char temp[11][12];          /* [11][12]: 11 strings, of length 12 */
+    RMC_data RMC_parsed;
     
     //Copy original RMC sentence to a copy in order to not destroy message
-    strcpy(RMC_message_copy,RMC_data_parse->Message);
+    strcpy(RMC_message_copy,RMC_sentence);
+    strcpy(RMC_parsed.Message, RMC_sentence);
+    // pc2.printf(RMC_data_parse->Message);
     
     //Seperated Message
     /* get the first token */
@@ -27,19 +35,36 @@
    }
      
     //Copy the message into its individual components
-    strcpy(RMC_data_parse->Message_ID,temp[0]);
-    strcpy(RMC_data_parse->UTC_Time,temp[1]);
-    strcpy(RMC_data_parse->Status,temp[2]);
-    strcpy(RMC_data_parse->Latitude,temp[3]);
-    strcpy(RMC_data_parse->N_S_Indicator,temp[4]);
-    strcpy(RMC_data_parse->Longitude,temp[5]);
-    strcpy(RMC_data_parse->E_W_Indicator,temp[6]);
-    strcpy(RMC_data_parse->Speed_Over_Ground,temp[7]);
-    strcpy(RMC_data_parse->Course_Over_Ground,temp[8]);
-    strcpy(RMC_data_parse->Date,temp[9]);
-    strcpy(RMC_data_parse->Magnetic_Variation,temp[10]);
-    strcpy(RMC_data_parse->Magnetic_E_W_Indicator,temp[11]);
-    strcpy(RMC_data_parse->Mode,temp[12]);
+    strcpy(RMC_parsed.Message_ID,temp[0]);
+    strcpy(RMC_parsed.UTC_Time,temp[1]);
+    strcpy(RMC_parsed.Status,temp[2]);
+    if(strcmp(RMC_parsed.Status,"A") == 0){
+        strcpy(RMC_parsed.Latitude,temp[3]);
+        strcpy(RMC_parsed.N_S_Indicator,temp[4]);
+        strcpy(RMC_parsed.Longitude,temp[5]);
+        strcpy(RMC_parsed.E_W_Indicator,temp[6]);
+        strcpy(RMC_parsed.Speed_Over_Ground,temp[7]);
+        strcpy(RMC_parsed.Course_Over_Ground,temp[8]);
+        strcpy(RMC_parsed.Date,temp[9]);
+        strcpy(RMC_parsed.Mode,temp[10]);
+    }
+    return RMC_parsed;
 }
 
-// Used GPS data pares function? // parses into data formats that will be sent over LoRa?
\ No newline at end of file
+// Use GPS data parse function? // parses into data formats that will be sent over LoRa
+
+void Print_RMC_data(RMC_data *RMC_data_print){
+    pc2.printf("RMC_Message: %s\r\n",RMC_data_print->Message);
+    pc2.printf("UTC_Time: %s\r\n",RMC_data_print->UTC_Time);
+    pc2.printf("Status: %s\r\n",RMC_data_print->Status);
+    if(strcmp(RMC_data_print->Status,"A") == 0){
+        pc2.printf("Latitude: %s\r\n",RMC_data_print->Latitude);
+        pc2.printf("N/S: %s\r\n",RMC_data_print->N_S_Indicator);
+        pc2.printf("Longitude: %s\r\n",RMC_data_print->Longitude);
+        pc2.printf("E/W: %s\r\n",RMC_data_print->E_W_Indicator);
+        pc2.printf("Speed: %s\r\n",RMC_data_print->Speed_Over_Ground);
+        pc2.printf("Course: %s\r\n",RMC_data_print->Course_Over_Ground);
+        pc2.printf("Date: %s\r\n",RMC_data_print->Date);
+        pc2.printf("Mode: %s\r\n",RMC_data_print->Mode);
+    }
+}
\ No newline at end of file