diff --git a/master/master/lib/gps.c b/master/master/lib/gps.c --- a/master/master/lib/gps.c +++ b/master/master/lib/gps.c @@ -52,17 +52,35 @@ char* get_timestamp() } char latitude[14]; //lllll.lla -char* get_latitude() +char latitudeTmp[8]; +char* get_latitudeTrimmed() { - return latitude; + strncpy(latitudeTmp, &latitude[0], 7); + latitudeTmp[7] = 0x00; + return latitudeTmp; +} +char* get_latitudeLSBs() +{ + strncpy(latitudeTmp, &latitude[7], 3); + latitudeTmp[3] = 0x00; + return latitudeTmp; } char longitude[14]; //yyyyy.yyb -char* get_longitude() +char longitudeTmp[9]; + +char* get_longitudeTrimmed() { - return longitude; + strncpy(longitudeTmp, &longitude[0], 8); + longitudeTmp[8] = 0x00; + return longitudeTmp; } - +char* get_longitudeLSBs() +{ + strncpy(longitudeTmp, &longitude[8], 3); + longitudeTmp[3] = 0x00; + return longitudeTmp; +} char quality; //quality for GGA and validity for RMC char numSatellites[4]; @@ -290,7 +308,7 @@ void parse_gps_transmission(void){ else if (byte == ',') //end of this data type { - latitude[7] = 0x00; // null terminate + latitude[numBytes] = 0x00; // null terminate setParserState(GGA_LONGITUDE); skipBytes = 0; //prep for next phase of parse @@ -322,7 +340,7 @@ void parse_gps_transmission(void){ } else if (byte == ',') //end of this data type { - longitude[8] = 0x00; + longitude[numBytes] = 0x00; setParserState(GGA_QUALITY); numBytes = 0; //prep for next phase of parse skipBytes = 0;