GPS working with LoRa code - can't transmit faster that once every 6 seconds
Dependencies: mbed LoRaWAN-lib_gps_lora SingleFrequencyLora
Diff: l86.cpp
- Revision:
- 11:f2a7f98cc9bf
- Parent:
- 10:0b5a507b4a4d
- Child:
- 12:d9144f16d78b
diff -r 0b5a507b4a4d -r f2a7f98cc9bf l86.cpp --- a/l86.cpp Tue Nov 14 16:06:16 2017 +0000 +++ b/l86.cpp Wed Nov 15 15:27:36 2017 +0000 @@ -68,23 +68,34 @@ /* Parse RMC_data struct into GPS data struct ready for sending over LoRa */ GPS_data Parse_RMC_data(RMC_data RMC_parsed){ GPS_data GPS_parsed; - strcpy(GPS_parsed.UTC_Time,RMC_parsed.UTC_Time); - if (strcmp(RMC_parsed.N_S_Indicator, "N") == 0){ - strcpy(GPS_parsed.Latitude, strcat("+", RMC_parsed.Latitude)); - } - else{ - strcpy(GPS_parsed.Latitude, strcat("-", RMC_parsed.Latitude)); + if(strcmp(RMC_parsed.Status,"A") == 0){ + strcpy(GPS_parsed.UTC_Time,RMC_parsed.UTC_Time); + if (strcmp(RMC_parsed.N_S_Indicator, "N") == 0){ + strcpy(GPS_parsed.Latitude, strcat("+", RMC_parsed.Latitude)); + } + else{ + strcpy(GPS_parsed.Latitude, strcat("-", RMC_parsed.Latitude)); + } + if (strcmp(RMC_parsed.E_W_Indicator, "E") == 0){ + strcpy(GPS_parsed.Longitude, strcat("+", RMC_parsed.Longitude)); + } + else{ + strcpy(GPS_parsed.Longitude, strcat("-", RMC_parsed.Longitude)); + } + strcpy(GPS_parsed.Speed_Over_Ground,RMC_parsed.Speed_Over_Ground); + strcpy(GPS_parsed.Course_Over_Ground,RMC_parsed.Course_Over_Ground); + strcpy(GPS_parsed.Date,RMC_parsed.Date); + strcpy(GPS_parsed.Valid,RMC_parsed.Status); } - if (strcmp(RMC_parsed.E_W_Indicator, "E") == 0){ - strcpy(GPS_parsed.Longitude, strcat("+", RMC_parsed.Latitude)); + else { + strcpy(GPS_parsed.UTC_Time, "000000.000"); + strcpy(GPS_parsed.Latitude,"+0000.0000"); + strcpy(GPS_parsed.Longitude,"+00000.0000"); + strcpy(GPS_parsed.Speed_Over_Ground,"0.00"); + strcpy(GPS_parsed.Course_Over_Ground,"000.00"); + strcpy(GPS_parsed.Date,"000000"); + strcpy(GPS_parsed.Valid,"V"); } - else{ - strcpy(GPS_parsed.Longitude, strcat("-", RMC_parsed.Latitude)); - } - strcpy(GPS_parsed.Speed_Over_Ground,RMC_parsed.Speed_Over_Ground); - strcpy(GPS_parsed.Course_Over_Ground,RMC_parsed.Course_Over_Ground); - strcpy(GPS_parsed.Date,RMC_parsed.Date); - strcpy(GPS_parsed.Valid,RMC_parsed.Status); return GPS_parsed; }