Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 780 → Rev 781

/branches/V0.68d Code Redesign killagreg/ubx.c
21,7 → 21,6
 
#define UBX_ID_POSLLH 0x02
#define UBX_ID_SOL 0x06
#define UBX_ID_POSUTM 0x08
#define UBX_ID_VELNED 0x12
 
#define UBX_SYNC1_CHAR 0xB5
60,16 → 59,6
} GPS_POSLLH_t;
 
typedef struct {
uint32_t ITOW; // ms GPS Millisecond Time of Week
int32_t EAST; // cm UTM Easting
int32_t NORTH; // cm UTM Nording
int32_t ALT; // cm altitude
uint8_t ZONE; // UTM zone number
uint8_t HEM; // Hemisphere Indicator (0=North, 1=South)
uint8_t Status;
} GPS_POSUTM_t;
 
typedef struct {
uint32_t ITOW; // ms GPS Millisecond Time of Week
int32_t VEL_N; // cm/s NED north velocity
int32_t VEL_E; // cm/s NED east velocity
84,7 → 73,6
 
GPS_SOL_t GpsSol = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, INVALID};
GPS_POSLLH_t GpsPosLlh = {0,0,0,0,0,0,0, INVALID};
GPS_POSUTM_t GpsPosUtm = {0,0,0,0,0,0, INVALID};
GPS_VELNED_t GpsVelNed = {0,0,0,0,0,0,0,0,0, INVALID};
GPS_INFO_t GPSInfo = {0,0,0,0,0,0,0,0,0,0, INVALID};
 
107,13 → 95,6
GPSInfo.altitude = GpsPosLlh.HEIGHT;
GpsPosLlh.Status = PROCESSED; // never update old data
}
if (GpsPosUtm.Status == VALID) // valid packet
{
GPSInfo.utmeast = GpsPosUtm.EAST;
GPSInfo.utmnorth = GpsPosUtm.NORTH;
GPSInfo.utmalt = GpsPosUtm.ALT;
GpsPosUtm.Status = PROCESSED; // never update old data
}
if (GpsVelNed.Status == VALID) // valid packet
{
GPSInfo.veleast = GpsVelNed.VEL_E;
121,7 → 102,7
GPSInfo.veltop = -GpsVelNed.VEL_D;
GpsVelNed.Status = PROCESSED; // never update old data
}
if ((GpsSol.Status != INVALID) && (GpsPosLlh.Status != INVALID) && (GpsPosUtm.Status != INVALID) && (GpsVelNed.Status != INVALID))
if ((GpsSol.Status != INVALID) && (GpsPosLlh.Status != INVALID) && (GpsVelNed.Status != INVALID))
{
GPSInfo.status = VALID; // set valid if data are updated
}
156,12 → 137,6
case UBXSTATE_CLASS: // check message identifier
switch(c)
{
case UBX_ID_POSUTM: // utm position
ubxP = (int8_t *)&GpsPosUtm; // data start pointer
ubxEp = (int8_t *)(&GpsPosUtm + sizeof(GPS_POSUTM_t)); // data end pointer
ubxSp = (int8_t *)&GpsPosUtm.Status; // status pointer
break;
 
case UBX_ID_POSLLH: // geodetic position
ubxP = (int8_t *)&GpsPosLlh; // data start pointer
ubxEp = (int8_t *)(&GpsPosLlh + sizeof(GPS_POSLLH_t)); // data end pointer