Rev 212 | Rev 245 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 212 | Rev 244 | ||
---|---|---|---|
Line 169... | Line 169... | ||
169 | volatile ubx_nav_sol_t UbxSol = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, INVALID}; |
169 | volatile ubx_nav_sol_t UbxSol = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, INVALID}; |
170 | volatile ubx_nav_posllh_t UbxPosLlh = {0,0,0,0,0,0,0, INVALID}; |
170 | volatile ubx_nav_posllh_t UbxPosLlh = {0,0,0,0,0,0,0, INVALID}; |
171 | volatile ubx_nav_velned_t UbxVelNed = {0,0,0,0,0,0,0,0,0, INVALID}; |
171 | volatile ubx_nav_velned_t UbxVelNed = {0,0,0,0,0,0,0,0,0, INVALID}; |
Line 172... | Line 172... | ||
172 | 172 | ||
173 | // shared buffer |
173 | // shared buffer |
174 | gps_data_t GPSData = {{0,0,0,INVALID},0,0,0,0,0,0,0, INVALID}; |
174 | gps_data_t GPSData = {200,{0,0,0,INVALID},0,0,0,0,0,0,0, INVALID}; |
Line 175... | Line 175... | ||
175 | DateTime_t GPSDateTime = {0,0,0,0,0,0,0, INVALID}; |
175 | DateTime_t GPSDateTime = {0,0,0,0,0,0,0, INVALID}; |
176 | 176 | ||
Line 278... | Line 278... | ||
278 | /********************************************************/ |
278 | /********************************************************/ |
279 | void Update_GPSData (void) |
279 | void Update_GPSData (void) |
280 | { |
280 | { |
281 | static u32 Msg_Count_Timeout = 0; |
281 | static u32 Msg_Count_Timeout = 0; |
282 | static u8 Msg_Count = 0; |
282 | static u8 Msg_Count = 0; |
- | 283 | static u32 LastTimeStamp = 0; |
|
- | 284 | u32 TimeStamp; |
|
Line 283... | Line 285... | ||
283 | 285 | ||
284 | // the timeout is used to detect the delay between two message sets |
286 | // the timeout is used to detect the delay between two message sets |
285 | // and is used for synchronisation so that always a set is collected |
287 | // and is used for synchronisation so that always a set is collected |
286 | // that belongs together |
288 | // that belongs together |
Line 297... | Line 299... | ||
297 | { // if set is complete |
299 | { // if set is complete |
298 | if((UbxSol.Status == NEWDATA) && (UbxPosLlh.Status == NEWDATA) && (UbxVelNed.Status == NEWDATA)) |
300 | if((UbxSol.Status == NEWDATA) && (UbxPosLlh.Status == NEWDATA) && (UbxVelNed.Status == NEWDATA)) |
299 | { |
301 | { |
300 | UBX_Timeout = SetDelay(UBX_TIMEOUT); |
302 | UBX_Timeout = SetDelay(UBX_TIMEOUT); |
301 | DebugOut.Analog[9]++; |
303 | DebugOut.Analog[9]++; |
- | 304 | ||
302 | // update GPS data only if the status is INVALID or PROCESSED and the last ubx message was received within less than 100 ms |
305 | // update GPS data only if the status is INVALID or PROCESSED and the last ubx message was received within less than 100 ms |
303 | if(GPSData.Status != NEWDATA) // if last data were processed |
306 | if(GPSData.Status != NEWDATA) // if last data were processed |
304 | { // wait for new data at all neccesary ubx messages |
307 | { // wait for new data at all neccesary ubx messages |
305 | GPSData.Status = INVALID; |
308 | GPSData.Status = INVALID; |
- | 309 | // update message cycle time |
|
- | 310 | TimeStamp = CountMilliseconds; |
|
- | 311 | GPSData.MsgCycleTime = (u16)(TimeStamp - LastTimeStamp); |
|
- | 312 | LastTimeStamp = TimeStamp; |
|
- | 313 | DebugOut.Analog[16] = GPSData.MsgCycleTime; |
|
306 | // NAV SOL |
314 | // NAV SOL |
307 | GPSData.Flags = UbxSol.Flags; |
315 | GPSData.Flags = UbxSol.Flags; |
308 | GPSData.NumOfSats = UbxSol.numSV; |
316 | GPSData.NumOfSats = UbxSol.numSV; |
309 | GPSData.SatFix = UbxSol.GPSfix; |
317 | GPSData.SatFix = UbxSol.GPSfix; |
310 | GPSData.Position_Accuracy = UbxSol.PAcc; |
318 | GPSData.Position_Accuracy = UbxSol.PAcc; |