minmea_sentence_gll: adapt for new floating point format
This commit is contained in:
parent
f193e412c6
commit
f9394d2915
8
minmea.c
8
minmea.c
@ -441,8 +441,8 @@ bool minmea_parse_gll(struct minmea_sentence_gll *frame, const char *sentence)
|
|||||||
|
|
||||||
if (!minmea_scan(sentence, "tfdfdTcc",
|
if (!minmea_scan(sentence, "tfdfdTcc",
|
||||||
type,
|
type,
|
||||||
&frame->latitude, &frame->latitude_scale, &latitude_direction,
|
&frame->latitude, &latitude_direction,
|
||||||
&frame->longitude, &frame->longitude_scale, &longitude_direction,
|
&frame->longitude, &longitude_direction,
|
||||||
&frame->time,
|
&frame->time,
|
||||||
&frame->status,
|
&frame->status,
|
||||||
&frame->mode))
|
&frame->mode))
|
||||||
@ -450,8 +450,8 @@ bool minmea_parse_gll(struct minmea_sentence_gll *frame, const char *sentence)
|
|||||||
if (strcmp(type+2, "GLL"))
|
if (strcmp(type+2, "GLL"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
frame->latitude *= latitude_direction;
|
frame->latitude.value *= latitude_direction;
|
||||||
frame->longitude *= longitude_direction;
|
frame->longitude.value *= longitude_direction;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
4
minmea.h
4
minmea.h
@ -89,8 +89,8 @@ enum minmea_gll_mode {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct minmea_sentence_gll {
|
struct minmea_sentence_gll {
|
||||||
int latitude, latitude_scale;
|
struct minmea_float latitude;
|
||||||
int longitude, longitude_scale;
|
struct minmea_float longitude;
|
||||||
struct minmea_time time;
|
struct minmea_time time;
|
||||||
char status;
|
char status;
|
||||||
char mode;
|
char mode;
|
||||||
|
19
tests.c
19
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";
|
const char *sentence = "$GPGLL,3723.2475,N,12158.3416,W,161229.487,A,A*41";
|
||||||
struct minmea_sentence_gll frame = {};
|
struct minmea_sentence_gll frame = {};
|
||||||
struct minmea_sentence_gll expected = {};
|
struct minmea_sentence_gll expected = {
|
||||||
|
.latitude = { 37232475, 10000 },
|
||||||
expected.latitude = 37232475;
|
.longitude = { -121583416, 10000 },
|
||||||
expected.latitude_scale = 10000;
|
.time = { 16, 12, 29, 487000 },
|
||||||
expected.longitude = -121583416;
|
.status = MINMEA_GLL_STATUS_DATA_VALID,
|
||||||
expected.longitude_scale = 10000;
|
.mode = MINMEA_GLL_MODE_AUTONOMOUS,
|
||||||
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;
|
|
||||||
|
|
||||||
ck_assert(minmea_check(sentence) == true);
|
ck_assert(minmea_check(sentence) == true);
|
||||||
ck_assert(minmea_parse_gll(&frame, sentence) == true);
|
ck_assert(minmea_parse_gll(&frame, sentence) == true);
|
||||||
|
Loading…
Reference in New Issue
Block a user