Rev 724 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 724 | Rev 726 | ||
---|---|---|---|
Line 69... | Line 69... | ||
69 | uint32_t CAcc; // deg Course / Heading Accuracy Estimate |
69 | uint32_t CAcc; // deg Course / Heading Accuracy Estimate |
70 | uint8_t Status; |
70 | uint8_t Status; |
71 | } GPS_VELNED_t; |
71 | } GPS_VELNED_t; |
Line 72... | Line 72... | ||
72 | 72 | ||
73 | 73 | ||
74 | GPS_STATUS_t GpsStatus; |
74 | GPS_STATUS_t GpsStatus = {0,0,0,0,0,0,0, INVALID}; |
75 | GPS_POSLLH_t GpsPosLlh; |
75 | GPS_POSLLH_t GpsPosLlh = {0,0,0,0,0,0,0, INVALID}; |
- | 76 | GPS_POSUTM_t GpsPosUtm = {0,0,0,0,0,0, INVALID}; |
|
Line 76... | Line 77... | ||
76 | GPS_POSUTM_t GpsPosUtm; |
77 | GPS_VELNED_t GpsVelNed = {0,0,0,0,0,0,0,0,0, INVALID}; |
Line 77... | Line 78... | ||
77 | GPS_VELNED_t GpsVelNed; |
78 | GPS_INFO_t GPSInfo = {0,0,0,0,0,0,0,0,0,0, INVALID}; |
78 | 79 | ||
79 | GPS_INFO_t GPSInfo; |
80 | volatile uint8_t GPSTimeout = 0; |
80 | 81 | ||
81 | void UpdateGPSInfo (void) |
82 | void UpdateGPSInfo (void) |
82 | { |
83 | { |
83 | if (GpsStatus.Status == VALID) // valid packet |
84 | if (GpsStatus.Status == VALID) // valid packet |
84 | { |
85 | { |
85 | GPSInfo.satfix = GpsStatus.GPSfix; |
86 | GPSInfo.satfix = GpsStatus.GPSfix; |
86 | GpsStatus.Status = PROCESSED; // never update old data |
87 | GpsStatus.Status = PROCESSED; // never update old data |
87 | } |
88 | } |
88 | if (GpsPosLlh.Status == VALID) // valid packet |
89 | if (GpsPosLlh.Status == VALID) // valid packet |
89 | { |
90 | { |
90 | GPSInfo.longitude = GpsPosLlh.LON; |
91 | GPSInfo.longitude = GpsPosLlh.LON; |
91 | GPSInfo.latitude = GpsPosLlh.LAT; |
92 | GPSInfo.latitude = GpsPosLlh.LAT; |
92 | GPSInfo.altitude = GpsPosLlh.HEIGHT; |
93 | GPSInfo.altitude = GpsPosLlh.HEIGHT; |
93 | GpsPosLlh.Status = PROCESSED; // never update old data |
94 | GpsPosLlh.Status = PROCESSED; // never update old data |
94 | } |
95 | } |
95 | if (GpsPosUtm.Status == VALID) // valid packet |
96 | if (GpsPosUtm.Status == VALID) // valid packet |
96 | { |
97 | { |
97 | GPSInfo.utmeast = GpsPosUtm.EAST; |
98 | GPSInfo.utmeast = GpsPosUtm.EAST; |
98 | GPSInfo.utmnorth = GpsPosUtm.NORTH; |
99 | GPSInfo.utmnorth = GpsPosUtm.NORTH; |
99 | GPSInfo.utmalt = GpsPosUtm.ALT; |
100 | GPSInfo.utmalt = GpsPosUtm.ALT; |
100 | GpsPosUtm.Status = PROCESSED; // never update old data |
101 | GpsPosUtm.Status = PROCESSED; // never update old data |
101 | } |
102 | } |
102 | if (GpsVelNed.Status == VALID) // valid packet |
103 | if (GpsVelNed.Status == VALID) // valid packet |
103 | { |
104 | { |
104 | GPSInfo.veleast = GpsVelNed.VEL_E; |
105 | GPSInfo.veleast = GpsVelNed.VEL_E; |
105 | GPSInfo.velnorth = GpsVelNed.VEL_N; |
106 | GPSInfo.velnorth = GpsVelNed.VEL_N; |
106 | GPSInfo.veltop = -GpsVelNed.VEL_D; |
107 | GPSInfo.veltop = -GpsVelNed.VEL_D; |
107 | GpsVelNed.Status = PROCESSED; // never update old data |
108 | GpsVelNed.Status = PROCESSED; // never update old data |
108 | } |
109 | } |
109 | if (GpsStatus.Status != INVALID) |
110 | if (GpsStatus.Status != INVALID) |
Line 110... | Line -... | ||
110 | { |
- | |
111 | GPSInfo.status = VALID; // set valid if data are updated |
- | |
112 | } |
- | |
113 | } |
- | |
114 | - | ||
115 | void ubx_init(void) |
- | |
116 | { |
- | |
117 | GpsStatus.Status = INVALID; |
- | |
Line 118... | Line 111... | ||
118 | GpsPosLlh.Status = INVALID; |
111 | { |
119 | GpsPosUtm.Status = INVALID; |
112 | GPSInfo.status = VALID; // set valid if data are updated |
120 | GpsVelNed.Status = INVALID; |
113 | } |
121 | GPSInfo.status = INVALID; |
114 | } |
Line 226... | Line 219... | ||
226 | if (c == ckb) |
219 | if (c == ckb) |
227 | { |
220 | { |
228 | *ubxSp = VALID; // new data are valid |
221 | *ubxSp = VALID; // new data are valid |
229 | ROT_FLASH; |
222 | ROT_FLASH; |
230 | UpdateGPSInfo(); //update GPS info respectively |
223 | UpdateGPSInfo(); //update GPS info respectively |
- | 224 | GPSTimeout = 255; |
|
231 | } |
225 | } |
232 | else |
226 | else |
233 | { // if checksum not fit then set data invalid |
227 | { // if checksum not fit then set data invalid |
234 | *ubxSp = INVALID; |
228 | *ubxSp = INVALID; |
235 | } |
229 | } |