GPGSA support: adapt to project' coding style
This commit is contained in:
parent
a04115b3f4
commit
d517458085
40
minmea.c
40
minmea.c
@ -344,18 +344,18 @@ bool minmea_parse_gpgsa(struct minmea_gpgsa *frame, const char *sentence)
|
||||
type,
|
||||
&frame->mode,
|
||||
&frame->fix_type,
|
||||
&frame->sat1,
|
||||
&frame->sat2,
|
||||
&frame->sat3,
|
||||
&frame->sat4,
|
||||
&frame->sat5,
|
||||
&frame->sat6,
|
||||
&frame->sat7,
|
||||
&frame->sat8,
|
||||
&frame->sat9,
|
||||
&frame->sat10,
|
||||
&frame->sat11,
|
||||
&frame->sat12,
|
||||
&frame->sats[0],
|
||||
&frame->sats[1],
|
||||
&frame->sats[2],
|
||||
&frame->sats[3],
|
||||
&frame->sats[4],
|
||||
&frame->sats[5],
|
||||
&frame->sats[6],
|
||||
&frame->sats[7],
|
||||
&frame->sats[8],
|
||||
&frame->sats[9],
|
||||
&frame->sats[10],
|
||||
&frame->sats[11],
|
||||
&frame->pdop,
|
||||
&frame->pdop_scale,
|
||||
&frame->hdop,
|
||||
@ -368,22 +368,6 @@ bool minmea_parse_gpgsa(struct minmea_gpgsa *frame, const char *sentence)
|
||||
if (strcmp(type, "GPGSA"))
|
||||
return false;
|
||||
|
||||
if (frame->mode == 'A')
|
||||
frame->mode = GPGSA_MODE_AUTO;
|
||||
else if (frame->mode == 'M')
|
||||
frame->mode = GPGSA_MODE_FORCED;
|
||||
else
|
||||
return false;
|
||||
|
||||
if (frame->fix_type == 1)
|
||||
frame->fix_type = GPGSA_FIX_NONE;
|
||||
else if (frame->fix_type == 2)
|
||||
frame->fix_type = GPGSA_FIX_2D;
|
||||
else if (frame->fix_type == 3)
|
||||
frame->fix_type = GPGSA_FIX_3D;
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
25
minmea.h
25
minmea.h
@ -67,31 +67,20 @@ struct minmea_gpgga {
|
||||
};
|
||||
|
||||
enum minmea_gpgsa_mode {
|
||||
GPGSA_MODE_AUTO,
|
||||
GPGSA_MODE_FORCED
|
||||
MINMEA_GPGSA_MODE_AUTO = 'A',
|
||||
MINMEA_GPGSA_MODE_FORCED = 'M',
|
||||
};
|
||||
|
||||
enum minmea_gpgsa_fix_type {
|
||||
GPGSA_FIX_NONE,
|
||||
GPGSA_FIX_2D,
|
||||
GPGSA_FIX_3D
|
||||
MINMEA_GPGSA_FIX_NONE = 1,
|
||||
MINMEA_GPGSA_FIX_2D = 2,
|
||||
MINMEA_GPGSA_FIX_3D =3,
|
||||
};
|
||||
|
||||
struct minmea_gpgsa {
|
||||
int mode;
|
||||
char mode;
|
||||
int fix_type;
|
||||
int sat1;
|
||||
int sat2;
|
||||
int sat3;
|
||||
int sat4;
|
||||
int sat5;
|
||||
int sat6;
|
||||
int sat7;
|
||||
int sat8;
|
||||
int sat9;
|
||||
int sat10;
|
||||
int sat11;
|
||||
int sat12;
|
||||
int sats[12];
|
||||
int pdop, pdop_scale;
|
||||
int hdop, hdop_scale;
|
||||
int vdop, vdop_scale;
|
||||
|
17
tests.c
17
tests.c
@ -337,20 +337,9 @@ START_TEST(test_minmea_parse_gpgsa1)
|
||||
const char *sentence = "$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39";
|
||||
struct minmea_gpgsa frame = {};
|
||||
struct minmea_gpgsa expected = {
|
||||
.mode = GPGSA_MODE_AUTO,
|
||||
.fix_type = GPGSA_FIX_3D,
|
||||
.sat1 = 4,
|
||||
.sat2 = 5,
|
||||
.sat3 = 0,
|
||||
.sat4 = 9,
|
||||
.sat5 = 12,
|
||||
.sat6 = 0,
|
||||
.sat7 = 0,
|
||||
.sat8 = 24,
|
||||
.sat9 = 0,
|
||||
.sat10 = 0,
|
||||
.sat11 = 0,
|
||||
.sat12 = 0,
|
||||
.mode = MINMEA_GPGSA_MODE_AUTO,
|
||||
.fix_type = MINMEA_GPGSA_FIX_3D,
|
||||
.sats = { 4, 5, 0, 9, 12, 0, 0, 24, 0, 0, 0, 0 },
|
||||
.pdop = 25,
|
||||
.pdop_scale = 10,
|
||||
.hdop = 13,
|
||||
|
Loading…
Reference in New Issue
Block a user