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",
|
||||
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;
|
||||
}
|
||||
|
4
minmea.h
4
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;
|
||||
|
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";
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user