Rev 574 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 574 | Rev 645 | ||
---|---|---|---|
Line 55... | Line 55... | ||
55 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
55 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
56 | #include <string.h> |
56 | #include <string.h> |
57 | #include "91x_lib.h" |
57 | #include "91x_lib.h" |
58 | #include "uart1.h" |
58 | #include "uart1.h" |
59 | #include "ubx.h" |
59 | #include "ubx.h" |
- | 60 | #include "main.h" |
|
60 | #include "led.h" |
61 | #include "led.h" |
61 | #include "timer1.h" |
62 | #include "timer1.h" |
62 | #include "GPS.h" |
63 | #include "GPS.h" |
Line 63... | Line 64... | ||
63 | 64 | ||
Line 291... | Line 292... | ||
291 | UBX_Timeout = SetDelay(UBX_TIMEOUT); |
292 | UBX_Timeout = SetDelay(UBX_TIMEOUT); |
292 | DebugOut.Analog[9]++; |
293 | DebugOut.Analog[9]++; |
293 | // update GPS data only if the status is INVALID or PROCESSED |
294 | // update GPS data only if the status is INVALID or PROCESSED |
294 | if(GPSData.Status != NEWDATA) |
295 | if(GPSData.Status != NEWDATA) |
295 | { // wait for new data at all neccesary ubx messages |
296 | { // wait for new data at all neccesary ubx messages |
- | 297 | CountNewGpsDataIn5Sec++; |
|
296 | GPSData.Status = INVALID; |
298 | GPSData.Status = INVALID; |
297 | // update message cycle time |
299 | // update message cycle time |
298 | GPSData.MsgCycleTime = (u16)(UbxSol.itow-last_itow); |
300 | GPSData.MsgCycleTime = (u16)(UbxSol.itow-last_itow); |
299 | milliseconds += GPSData.MsgCycleTime; |
301 | milliseconds += GPSData.MsgCycleTime; |
300 | last_itow = UbxSol.itow; // update last itow |
302 | last_itow = UbxSol.itow; // update last itow |
301 | // NAV SOL |
303 | // NAV SOL |
302 | GPSData.Flags = (GPSData.Flags & 0xf0) | (UbxSol.Flags & 0x0f); // we take only the lower bits |
304 | GPSData.Flags = (GPSData.Flags & 0xf0) | (UbxSol.Flags & 0x0f); // we take only the lower bits |
303 | GPSData.NumOfSats = UbxSol.numSV; |
305 | GPSData.NumOfSats = UbxSol.numSV; |
304 | GPSData.SatFix = UbxSol.GPSfix; |
306 | GPSData.SatFix = UbxSol.GPSfix; |
- | 307 | //if(Parameter.User3 > 100) { GPSData.NumOfSats = 0; GPSData.SatFix = 0;} |
|
- | 308 | //if(Parameter.User3 > 100) { GPSData.SatFix = 0;} |
|
305 | GPSData.Position_Accuracy = UbxSol.PAcc; // in steps of 1cm |
309 | GPSData.Position_Accuracy = UbxSol.PAcc; // in steps of 1cm |
306 | GPSData.Speed_Accuracy = UbxSol.SAcc; // in steps of 1cm/s |
310 | GPSData.Speed_Accuracy = UbxSol.SAcc; // in steps of 1cm/s |
307 | SetGPSTime(&SystemTime); // update system time |
311 | SetGPSTime(&SystemTime); // update system time |
308 | // NAV VELNED |
312 | // NAV VELNED |
309 | GPSData.Speed_East = UbxVelNed.VEL_E; // in steps of 1cm/s |
313 | GPSData.Speed_East = UbxVelNed.VEL_E; // in steps of 1cm/s |
Line 321... | Line 325... | ||
321 | } |
325 | } |
322 | else // simulation active |
326 | else // simulation active |
323 | { |
327 | { |
324 | if(GPSData.SatFix != SATFIX_3D || GPSData.NumOfSats < 6) // simulate satfix |
328 | if(GPSData.SatFix != SATFIX_3D || GPSData.NumOfSats < 6) // simulate satfix |
325 | { |
329 | { |
326 | GPSData.SatFix = SATFIX_3D; |
330 | GPSData.SatFix = SATFIX_3D; // Simulation |
327 | GPSData.Flags |= FLAG_GPSFIXOK; |
331 | GPSData.Flags |= FLAG_GPSFIXOK; // Simulation |
328 | GPSData.NumOfSats = 8; |
332 | GPSData.NumOfSats = 8; // Simulation |
329 | if(!SystemTime.Valid) |
333 | if(!SystemTime.Valid) |
330 | { |
334 | { |
331 | UbxSol.Status = 1; |
335 | UbxSol.Status = 1; |
332 | UbxSol.Flags |= FLAG_WKNSET; |
336 | UbxSol.Flags |= FLAG_WKNSET; |
333 | UbxSol.Flags |= FLAG_TOWSET; |
337 | UbxSol.Flags |= FLAG_TOWSET; |
Line 517... | Line 521... | ||
517 | UbxMsg.Status = NEWDATA; |
521 | UbxMsg.Status = NEWDATA; |
518 | } |
522 | } |
519 | } // EOF filter matches |
523 | } // EOF filter matches |
520 | } // EOF != INVALID |
524 | } // EOF != INVALID |
521 | }// EOF crc ok |
525 | }// EOF crc ok |
- | 526 | else DebugOut.Analog[13]++; // CRC Error -> since 2.10e (6.2015) |
|
522 | ubxState = UBXSTATE_IDLE; // ready to parse new data |
527 | ubxState = UBXSTATE_IDLE; // ready to parse new data |
523 | break; |
528 | break; |
Line 524... | Line 529... | ||
524 | 529 | ||
525 | default: // unknown ubx state |
530 | default: // unknown ubx state |