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 @@ -454,7 +454,15 @@ void parse_gps_transmission(void){ } else if(byte == ',') //end of this data type { - altitude[numBytes] = 0x00; + // If we actually have an altitude + if(numBytes>0) + { + altitude[numBytes-1] = 0x00; // Cut off the "M" from the end of the altitude + } + else + { + altitude[numBytes] = 0x00; + } setParserState(GGA_WGS84); numBytes = 0; //prep for next phase of parse }