diff --git a/cm_nmea_decoder.c b/cm_nmea_decoder.c index 0c21e27..3a1983d 100644 --- a/cm_nmea_decoder.c +++ b/cm_nmea_decoder.c @@ -23,6 +23,8 @@ static int findLenToChar(const char *str, const char character){ static int sGPGLL_decode(cm_nmea_msg_t *inst, char *str){ + printf("%s \r\n ",str); + //Move pointer until we meet a "," or NULL! while((str != NULL) && (*str != ',')) str++; @@ -36,7 +38,7 @@ static int sGPGLL_decode(cm_nmea_msg_t *inst, char *str){ str[comma_idx] = '\0'; // Decode first part of latitude - inst->gpgll_msg.coordinates.deg = atoi(str); + inst->gpgll_msg.coordinates.lat_deg = atoi(str); printf("deg: %d, str: %s \r\n ",comma_idx,str); diff --git a/cm_nmea_decoder.h b/cm_nmea_decoder.h index c7a2b3b..651ef3e 100644 --- a/cm_nmea_decoder.h +++ b/cm_nmea_decoder.h @@ -17,8 +17,12 @@ typedef enum { }nmea_msg_type; typedef struct{ - uint8_t deg; // Degrees: 0–90 (latitude) or 0–180 (longitude) - uint32_t min_x10000; // Minutes × 10,000 (e.g., 16.4512 → 164512) + uint8_t lat_deg; // Degrees: 0–90 (latitude) or 0–180 (longitude) + uint32_t lat_min_x10000; // Minutes × 10,000 (e.g., 16.4512 → 164512) + + uint8_t lon_deg; // Degrees: 0–90 (latitude) or 0–180 (longitude) + uint32_t lon_min_x10000; // Minutes × 10,000 (e.g., 16.4512 → 164512) + char dir; // 'N', 'S', 'E', or 'W' }cm_nmea_coord;