From f9394d2915e3b7604bdbe9ee382065de6550899c Mon Sep 17 00:00:00 2001
From: Kosma Moczek <kosma@cloudyourcar.com>
Date: Tue, 17 Jun 2014 14:57:08 +0200
Subject: [PATCH] minmea_sentence_gll: adapt for new floating point format

---
 minmea.c |  8 ++++----
 minmea.h |  4 ++--
 tests.c  | 19 +++++++------------
 3 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/minmea.c b/minmea.c
index 30cff39..0b06143 100644
--- a/minmea.c
+++ b/minmea.c
@@ -441,8 +441,8 @@ bool minmea_parse_gll(struct minmea_sentence_gll *frame, const char *sentence)
 
     if (!minmea_scan(sentence, "tfdfdTcc",
             type,
-            &frame->latitude, &frame->latitude_scale, &latitude_direction,
-            &frame->longitude, &frame->longitude_scale, &longitude_direction,
+            &frame->latitude, &latitude_direction,
+            &frame->longitude, &longitude_direction,
             &frame->time,
             &frame->status,
             &frame->mode))
@@ -450,8 +450,8 @@ bool minmea_parse_gll(struct minmea_sentence_gll *frame, const char *sentence)
     if (strcmp(type+2, "GLL"))
         return false;
 
-    frame->latitude *= latitude_direction;
-    frame->longitude *= longitude_direction;
+    frame->latitude.value *= latitude_direction;
+    frame->longitude.value *= longitude_direction;
 
     return true;
 }
diff --git a/minmea.h b/minmea.h
index 1eed800..216e4ec 100644
--- a/minmea.h
+++ b/minmea.h
@@ -89,8 +89,8 @@ enum minmea_gll_mode {
 };
 
 struct minmea_sentence_gll {
-    int latitude, latitude_scale;
-    int longitude, longitude_scale;
+    struct minmea_float latitude;
+    struct minmea_float longitude;
     struct minmea_time time;
     char status;
     char mode;
diff --git a/tests.c b/tests.c
index 819e937..9791a23 100644
--- a/tests.c
+++ b/tests.c
@@ -523,18 +523,13 @@ START_TEST(test_minmea_parse_gll1)
 {
     const char *sentence = "$GPGLL,3723.2475,N,12158.3416,W,161229.487,A,A*41";
     struct minmea_sentence_gll frame = {};
-    struct minmea_sentence_gll expected = {};
-
-    expected.latitude = 37232475;
-    expected.latitude_scale = 10000;
-    expected.longitude = -121583416;
-    expected.longitude_scale = 10000;
-    expected.time.hours = 16;
-    expected.time.minutes = 12;
-    expected.time.seconds = 29;
-    expected.time.microseconds = 487000;
-    expected.status = MINMEA_GLL_STATUS_DATA_VALID;
-    expected.mode = MINMEA_GLL_MODE_AUTONOMOUS;
+    struct minmea_sentence_gll expected = {
+        .latitude = { 37232475, 10000 },
+        .longitude = { -121583416, 10000 },
+        .time = { 16, 12, 29, 487000 },
+        .status = MINMEA_GLL_STATUS_DATA_VALID,
+        .mode = MINMEA_GLL_MODE_AUTONOMOUS,
+    };
 
     ck_assert(minmea_check(sentence) == true);
     ck_assert(minmea_parse_gll(&frame, sentence) == true);