Tidy up NMEA Code A Little

Still a LOT of tidying up needed in future, of the whole GPS module
really.
This commit is contained in:
tracernz 2015-01-31 18:07:05 +13:00
parent b8b248827c
commit c226f6a412
1 changed files with 115 additions and 113 deletions

View File

@ -69,6 +69,8 @@ extern int16_t debug[4];
#define LOG_UBLOX_POSLLH 'P'
#define LOG_UBLOX_VELNED 'V'
#define GPS_SV_MAXSATS 16
char gpsPacketLog[GPS_PACKET_LOG_ENTRY_COUNT];
static char *gpsPacketLogChar = gpsPacketLog;
// **********************
@ -86,10 +88,10 @@ uint16_t GPS_speed; // speed in 0.1m/s
uint16_t GPS_ground_course = 0; // degrees * 10
uint8_t GPS_numCh; // Number of channels
uint8_t GPS_svinfo_chn[16]; // Channel number
uint8_t GPS_svinfo_svid[16]; // Satellite ID
uint8_t GPS_svinfo_quality[16]; // Bitfield Qualtity
uint8_t GPS_svinfo_cno[16]; // Carrier to Noise Ratio (Signal Strength)
uint8_t GPS_svinfo_chn[GPS_SV_MAXSATS]; // Channel number
uint8_t GPS_svinfo_svid[GPS_SV_MAXSATS]; // Satellite ID
uint8_t GPS_svinfo_quality[GPS_SV_MAXSATS]; // Bitfield Qualtity
uint8_t GPS_svinfo_cno[GPS_SV_MAXSATS]; // Carrier to Noise Ratio (Signal Strength)
static gpsConfig_t *gpsConfig;
@ -514,18 +516,18 @@ static uint32_t grab_fields(char *src, uint8_t mult)
return tmp;
}
static bool gpsNewFrameNMEA(char c)
{
typedef struct gpsdata_s {
typedef struct gpsDataNmea_s {
int32_t latitude;
int32_t longitude;
uint8_t numSat;
uint16_t altitude;
uint16_t speed;
uint16_t ground_course;
} gpsdata_t;
} gpsDataNmea_t;
static gpsdata_t gps_Msg;
static bool gpsNewFrameNMEA(char c)
{
static gpsDataNmea_t gps_Msg;
uint8_t frameOK = 0;
static uint8_t param = 0, offset = 0, parity = 0;
@ -551,9 +553,9 @@ static bool gpsNewFrameNMEA(char c)
switch (gps_frame) {
case FRAME_GGA: //************* GPGGA FRAME parsing
switch (param) {
// case 1: // Time information
// break;
switch(param) {
// case 1: // Time information
// break;
case 2:
gps_Msg.latitude = GPS_coord_to_degrees(string);
break;
@ -584,7 +586,7 @@ static bool gpsNewFrameNMEA(char c)
}
break;
case FRAME_RMC: //************* GPRMC FRAME parsing
switch (param) {
switch(param) {
case 7:
gps_Msg.speed = ((grab_fields(string, 1) * 5144L) / 1000L); // speed in cm/s added by Mis
break;