Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 568 → Rev 569

/trunk/ubx.c
280,6 → 280,7
void Update_GPSData(void)
{
static u32 last_itow = 0;
static u32 milliseconds = 0;
 
// if a new set of ubx messages was collected
if((UbxSol.Status == NEWDATA) && (UbxPosLlh.Status == NEWDATA) && (UbxVelNed.Status == NEWDATA))
295,6 → 296,7
GPSData.Status = INVALID;
// update message cycle time
GPSData.MsgCycleTime = (u16)(UbxSol.itow-last_itow);
milliseconds += GPSData.MsgCycleTime;
last_itow = UbxSol.itow; // update last itow
// NAV SOL
GPSData.Flags = (GPSData.Flags & 0xf0) | (UbxSol.Flags & 0x0f); // we take only the lower bits
303,15 → 305,6
GPSData.Position_Accuracy = UbxSol.PAcc; // in steps of 1cm
GPSData.Speed_Accuracy = UbxSol.SAcc; // in steps of 1cm/s
SetGPSTime(&SystemTime); // update system time
// NAV POSLLH
GPSData.Position.Status = INVALID;
if(!(SimulationFlags & SIMULATION_ACTIVE))
{
GPSData.Position.Longitude = UbxPosLlh.LON; // in steps of 1E-7 deg
GPSData.Position.Latitude = UbxPosLlh.LAT; // in steps of 1E-7 deg
}
GPSData.Position.Altitude = UbxPosLlh.HMSL; // in steps of 1 mm
GPSData.Position.Status = NEWDATA;
// NAV VELNED
GPSData.Speed_East = UbxVelNed.VEL_E; // in steps of 1cm/s
GPSData.Speed_North = UbxVelNed.VEL_N; // in steps of 1cm/s
318,6 → 311,34
GPSData.Speed_Top = -UbxVelNed.VEL_D; // in steps of 1cm/s
GPSData.Speed_Ground = UbxVelNed.GSpeed; // in steps of 1cm/s
GPSData.Heading = UbxVelNed.Heading; //in steps of 1E-5 deg
// NAV POSLLH
GPSData.Position.Status = INVALID;
if(!(SimulationFlags & SIMULATION_ACTIVE))
{
GPSData.Position.Longitude = UbxPosLlh.LON; // in steps of 1E-7 deg
GPSData.Position.Latitude = UbxPosLlh.LAT; // in steps of 1E-7 deg
GPSData.Position.Altitude = UbxPosLlh.HMSL; // in steps of 1 mm
}
else // simulation active
{
if(GPSData.SatFix != SATFIX_3D) // simulate satfix
{
GPSData.SatFix = SATFIX_3D;
GPSData.Flags |= FLAG_GPSFIXOK;
GPSData.NumOfSats = 8;
if(!SystemTime.Valid)
{
UbxSol.Status = 1;
UbxSol.Flags |= FLAG_WKNSET;
UbxSol.Flags |= FLAG_TOWSET;
UbxSol.week = 1043; // starts in year 2000
UbxSol.itow = milliseconds;
SetGPSTime(&SystemTime); // update system time
SystemTime.Valid = 1; // use the time that is given by the GPS-Module
}
}
}
GPSData.Position.Status = NEWDATA;
 
GPSData.Status = NEWDATA; // new data available
} // EOF if(GPSData.Status != NEWDATA)