diff --git a/flight/modules/GPS/UBX.c b/flight/modules/GPS/UBX.c index c114d1c5c..df69fcf9e 100644 --- a/flight/modules/GPS/UBX.c +++ b/flight/modules/GPS/UBX.c @@ -255,41 +255,41 @@ void parse_ubx_nav_pvt(struct UBX_NAV_PVT *pvt, GPSPositionSensorData *GpsPositi { GPSVelocitySensorData GpsVelocity; - msgtracker.currentTOW = pvt->iTOW; + msgtracker.currentTOW = pvt->iTOW; msgtracker.msg_received = (SOL_RECEIVED | VELNED_RECEIVED | POSLLH_RECEIVED); - GpsVelocity.North = (float)pvt->velN / 100.0f; - GpsVelocity.East = (float)pvt->velE / 100.0f; - GpsVelocity.Down = (float)pvt->velD / 100.0f; - GPSVelocitySensorSet(&GpsVelocity); + GpsVelocity.North = (float)pvt->velN / 100.0f; + GpsVelocity.East = (float)pvt->velE / 100.0f; + GpsVelocity.Down = (float)pvt->velD / 100.0f; + GPSVelocitySensorSet(&GpsVelocity); - GpsPosition->Groundspeed = (float)pvt->gSpeed * 0.01f; - GpsPosition->Heading = (float)pvt->heading * 1.0e-5f; - GpsPosition->Altitude = (float)pvt->hMSL * 0.001f; - GpsPosition->GeoidSeparation = (float)(pvt->height - pvt->hMSL) * 0.001f; - GpsPosition->Latitude = pvt->lat; - GpsPosition->Longitude = pvt->lon; - GpsPosition->Satellites = pvt->numSV; - if(pvt->flags & PVT_FLAGS_GNNSFIX_OK) { - GpsPosition->Status = pvt->fixType == PVT_FIX_TYPE_3D ? - GPSPOSITIONSENSOR_STATUS_FIX3D : GPSPOSITIONSENSOR_STATUS_FIX2D; - } else { - GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_NOFIX; - } + GpsPosition->Groundspeed = (float)pvt->gSpeed * 0.01f; + GpsPosition->Heading = (float)pvt->heading * 1.0e-5f; + GpsPosition->Altitude = (float)pvt->hMSL * 0.001f; + GpsPosition->GeoidSeparation = (float)(pvt->height - pvt->hMSL) * 0.001f; + GpsPosition->Latitude = pvt->lat; + GpsPosition->Longitude = pvt->lon; + GpsPosition->Satellites = pvt->numSV; + if (pvt->flags & PVT_FLAGS_GNNSFIX_OK) { + GpsPosition->Status = pvt->fixType == PVT_FIX_TYPE_3D ? + GPSPOSITIONSENSOR_STATUS_FIX3D : GPSPOSITIONSENSOR_STATUS_FIX2D; + } else { + GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_NOFIX; + } #if !defined(PIOS_GPS_MINIMAL) - if (pvt->valid & PVT_VALID_VALIDTIME) { - // Time is valid, set GpsTime - GPSTimeData GpsTime; + if (pvt->valid & PVT_VALID_VALIDTIME) { + // Time is valid, set GpsTime + GPSTimeData GpsTime; - GpsTime.Year = pvt->year; - GpsTime.Month = pvt->month; - GpsTime.Day = pvt->day; - GpsTime.Hour = pvt->hour; - GpsTime.Minute = pvt->min; - GpsTime.Second = pvt->sec; + GpsTime.Year = pvt->year; + GpsTime.Month = pvt->month; + GpsTime.Day = pvt->day; + GpsTime.Hour = pvt->hour; + GpsTime.Minute = pvt->min; + GpsTime.Second = pvt->sec; - GPSTimeSet(&GpsTime); - } + GPSTimeSet(&GpsTime); + } #endif } #if !defined(PIOS_GPS_MINIMAL) diff --git a/flight/modules/GPS/inc/UBX.h b/flight/modules/GPS/inc/UBX.h index dc76f32fd..996dfd8d4 100644 --- a/flight/modules/GPS/inc/UBX.h +++ b/flight/modules/GPS/inc/UBX.h @@ -35,23 +35,23 @@ #include "GPS.h" -#define UBX_SYNC1 0xb5 // UBX protocol synchronization characters -#define UBX_SYNC2 0x62 +#define UBX_SYNC1 0xb5 // UBX protocol synchronization characters +#define UBX_SYNC2 0x62 // From u-blox6 receiver protocol specification // Messages classes -#define UBX_CLASS_NAV 0x01 +#define UBX_CLASS_NAV 0x01 // Message IDs -#define UBX_ID_POSLLH 0x02 -#define UBX_ID_STATUS 0x03 -#define UBX_ID_DOP 0x04 -#define UBX_ID_SOL 0x06 -#define UBX_ID_VELNED 0x12 -#define UBX_ID_TIMEUTC 0x21 -#define UBX_ID_SVINFO 0x30 -#define UBX_ID_PVT 0x07 +#define UBX_ID_POSLLH 0x02 +#define UBX_ID_STATUS 0x03 +#define UBX_ID_DOP 0x04 +#define UBX_ID_SOL 0x06 +#define UBX_ID_VELNED 0x12 +#define UBX_ID_TIMEUTC 0x21 +#define UBX_ID_SVINFO 0x30 +#define UBX_ID_PVT 0x07 // private structures