Rev 36 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 36 | Rev 37 | ||
---|---|---|---|
Line 48... | Line 48... | ||
48 | 48 | ||
49 | #define SYNC_CHAR1 0xb5 |
49 | #define SYNC_CHAR1 0xb5 |
Line 50... | Line 50... | ||
50 | #define SYNC_CHAR2 0x62 |
50 | #define SYNC_CHAR2 0x62 |
- | 51 | ||
51 | 52 | #define CLASS_NAV 0x01 |
|
52 | #define CLASS_NAV 0x01 |
53 | #define MSGID_POSECEF 0x01 |
- | 54 | #define MSGID_STATUS 0x03 |
|
53 | #define MSGID_STATUS 0x03 |
55 | //#define MSGID_POSLLH 0x02 |
54 | #define MSGID_POSLLH 0x02 |
56 | #define MSGID_VELECEF 0x11 |
Line 55... | Line 57... | ||
55 | #define MSGID_POSUTM 0x08 |
57 | //#define MSGID_POSUTM 0x08 |
56 | #define MSGID_VELNED 0x12 |
58 | //#define MSGID_VELNED 0x12 |
Line 66... | Line 68... | ||
66 | unsigned long TTFF; // Time to first fix (millisecond time tag) |
68 | unsigned long TTFF; // Time to first fix (millisecond time tag) |
67 | unsigned long MSSS; // Milliseconds since Startup / Reset |
69 | unsigned long MSSS; // Milliseconds since Startup / Reset |
68 | uint8_t packetStatus; |
70 | uint8_t packetStatus; |
69 | } NAV_STATUS_t; |
71 | } NAV_STATUS_t; |
Line 70... | Line 72... | ||
70 | 72 | ||
71 | 73 | /* |
|
72 | typedef struct { |
74 | typedef struct { |
73 | unsigned long ITOW; // time of week |
75 | unsigned long ITOW; // time of week |
74 | long LON; // longitude in 1e-07 deg |
76 | long LON; // longitude in 1e-07 deg |
75 | long LAT; // lattitude |
77 | long LAT; // lattitude |
Line 102... | Line 104... | ||
102 | long Heading; // deg (1e-05) Heading 2-D |
104 | long Heading; // deg (1e-05) Heading 2-D |
103 | unsigned long SAcc; // cm/s Speed Accuracy Estimate |
105 | unsigned long SAcc; // cm/s Speed Accuracy Estimate |
104 | unsigned long CAcc; // deg Course / Heading Accuracy Estimate |
106 | unsigned long CAcc; // deg Course / Heading Accuracy Estimate |
105 | uint8_t packetStatus; |
107 | uint8_t packetStatus; |
106 | } NAV_VELNED_t; |
108 | } NAV_VELNED_t; |
- | 109 | */ |
|
- | 110 | ||
- | 111 | typedef struct { |
|
- | 112 | unsigned long ITOW; // ms GPS Millisecond Time of Week |
|
- | 113 | long ECEF_X; // ecef x / cm |
|
- | 114 | long ECEF_Y; // ecef y / cm |
|
- | 115 | long ECEF_Z; // ecef z / cm |
|
- | 116 | unsigned long Pacc; // Abweichung |
|
- | 117 | uint8_t packetStatus; |
|
- | 118 | } NAV_POSECEF_t ; |
|
- | 119 | ||
- | 120 | typedef struct { |
|
- | 121 | unsigned long ITOW; // ms GPS Millisecond Time of Week |
|
- | 122 | long ECEFVX; // ecef x velocity cm/s |
|
- | 123 | long ECEFVY; // ecef y velocity cm/s |
|
- | 124 | long ECEFVZ; // ecef z velocity cm/s |
|
- | 125 | unsigned long SAcc; // Abweichung |
|
- | 126 | uint8_t packetStatus; |
|
- | 127 | } NAV_VELECEF_t; |
|
Line 107... | Line 128... | ||
107 | 128 | ||
- | 129 | ||
- | 130 | NAV_STATUS_t navStatus; |
|
- | 131 | NAV_POSECEF_t navPosECEF; |
|
108 | 132 | NAV_VELECEF_t navVelECEF; |
|
109 | NAV_STATUS_t navStatus; |
133 | |
110 | NAV_POSLLH_t navPosLlh; |
134 | //NAV_POSLLH_t navPosLlh; |
Line 111... | Line 135... | ||
111 | NAV_POSUTM_t navPosUtm; |
135 | //NAV_POSUTM_t navPosUtm; |
112 | NAV_VELNED_t navVelNed; |
136 | //NAV_VELECEF avVelNed; |
113 | 137 | ||
114 | volatile char *ubxP, *ubxEp, *ubxSp; // pointers to packet currently transfered |
138 | volatile char *ubxP, *ubxEp, *ubxSp; // pointers to packet currently transfered |
Line 153... | Line 177... | ||
153 | else ptr = 0; |
177 | else ptr = 0; |
154 | } |
178 | } |
Line 155... | Line 179... | ||
155 | 179 | ||
156 | void GPSscanData (void) |
180 | void GPSscanData (void) |
- | 181 | { |
|
- | 182 | ||
- | 183 | ||
- | 184 | if (navPosECEF.packetStatus == 1) // valid packet |
|
- | 185 | { |
|
- | 186 | actualPos.x = navPosECEF.ECEF_X; //ECEF X in cm |
|
- | 187 | actualPos.y = navPosECEF.ECEF_Y; //ECEF Y in cm |
|
- | 188 | actualPos.z = navPosECEF.ECEF_Z; //ECEF Z in cm |
|
- | 189 | navPosECEF.packetStatus = 0; |
|
- | 190 | } |
|
- | 191 | ||
157 | { |
192 | |
158 | if (navStatus.packetStatus == 1) // valid packet |
193 | if (navStatus.packetStatus == 1) // valid packet |
159 | { |
194 | { |
160 | actualPos.state = navStatus.GPSfix; |
195 | actualPos.state = navStatus.GPSfix; |
161 | navStatus.packetStatus = 0; |
196 | navStatus.packetStatus = 0; |
162 | } |
197 | } |
- | 198 | ||
- | 199 | if (navVelECEF.packetStatus == 1) // valid packet |
|
- | 200 | { |
|
- | 201 | actualPos.vx = navVelECEF.ECEFVX; //ECEF VEL X in cm/s |
|
- | 202 | actualPos.vy = navVelECEF.ECEFVY; //ECEF VEL Y in cm/s |
|
- | 203 | actualPos.vz = navVelECEF.ECEFVZ; //ECEF VEL Z in cm/s |
|
- | 204 | navVelECEF.packetStatus = 0; |
|
- | 205 | } |
|
163 | 206 | /* |
|
164 | if (navPosUtm.packetStatus == 1) // valid packet |
207 | if (navPosUtm.packetStatus == 1) // valid packet |
165 | { |
208 | { |
166 | actualPos.northing = navPosUtm.NORTH; ///10; // in 10cm; |
209 | actualPos.northing = navPosUtm.NORTH; ///10; // in 10cm; |
167 | actualPos.easting = navPosUtm.EAST; //10; |
210 | actualPos.easting = navPosUtm.EAST; //10; |
Line 175... | Line 218... | ||
175 | 218 | |
|
176 | if (navVelNed.packetStatus == 1){ |
219 | if (navVelNed.packetStatus == 1){ |
177 | actualPos.velNorth = navVelNed.VEL_N; |
220 | actualPos.velNorth = navVelNed.VEL_N; |
178 | actualPos.velEast = navVelNed.VEL_E; |
221 | actualPos.velEast = navVelNed.VEL_E; |
179 | navVelNed.packetStatus = 0;} |
222 | navVelNed.packetStatus = 0;} |
180 | /* |
223 | |
181 | navPosLlh and navVelNed currently not used |
224 | navPosLlh and navVelNed currently not used |
- | 225 | */ |
|
182 | */ |
226 | |
Line 183... | Line 227... | ||
183 | if (actualPos.state != 0){ROT_ON;} //-> Rot blinkt mit 4Hz wenn GPS Signal brauchbar |
227 | if (actualPos.state != 0){ROT_ON;} //-> Rot blinkt mit 4Hz wenn GPS Signal brauchbar |
Line 184... | Line 228... | ||
184 | 228 | ||
Line 250... | Line 294... | ||
250 | ubxP = (char*)&navStatus; |
294 | ubxP = (char*)&navStatus; |
251 | ubxEp = (char*)(&navStatus + sizeof(NAV_STATUS_t)); |
295 | ubxEp = (char*)(&navStatus + sizeof(NAV_STATUS_t)); |
252 | ubxSp = (char*)&navStatus.packetStatus; |
296 | ubxSp = (char*)&navStatus.packetStatus; |
253 | ignorePacket = navStatus.packetStatus; |
297 | ignorePacket = navStatus.packetStatus; |
254 | break; |
298 | break; |
- | 299 | case MSGID_POSECEF: |
|
- | 300 | ubxP = (char*)&navPosECEF; |
|
- | 301 | ubxEp = (char*)(&navPosECEF + sizeof(NAV_POSECEF_t)); |
|
- | 302 | ubxSp = (char*)&navPosECEF.packetStatus; |
|
- | 303 | ignorePacket = navPosECEF.packetStatus; |
|
- | 304 | break; |
|
- | 305 | case MSGID_VELECEF: |
|
- | 306 | ubxP = (char*)&navVelECEF; |
|
- | 307 | ubxEp = (char*)(&navVelECEF + sizeof(NAV_VELECEF_t)); |
|
- | 308 | ubxSp = (char*)&navVelECEF.packetStatus; |
|
- | 309 | ignorePacket = navVelECEF.packetStatus; |
|
- | 310 | break; |
|
- | 311 | ||
- | 312 | /* |
|
255 | case MSGID_POSLLH: |
313 | case MSGID_POSLLH: |
256 | ubxP = (char*)&navPosLlh; |
314 | ubxP = (char*)&navPosLlh; |
257 | ubxEp = (char*)(&navPosLlh + sizeof(NAV_POSLLH_t)); |
315 | ubxEp = (char*)(&navPosLlh + sizeof(NAV_POSLLH_t)); |
258 | ubxSp = (char*)&navPosLlh.packetStatus; |
316 | ubxSp = (char*)&navPosLlh.packetStatus; |
259 | ignorePacket = navPosLlh.packetStatus; |
317 | ignorePacket = navPosLlh.packetStatus; |
Line 268... | Line 326... | ||
268 | ubxP = (char*)&navVelNed; |
326 | ubxP = (char*)&navVelNed; |
269 | ubxEp = (char*)(&navVelNed + sizeof(NAV_VELNED_t)); |
327 | ubxEp = (char*)(&navVelNed + sizeof(NAV_VELNED_t)); |
270 | ubxSp = (char*)&navVelNed.packetStatus; |
328 | ubxSp = (char*)&navVelNed.packetStatus; |
271 | ignorePacket = navVelNed.packetStatus; |
329 | ignorePacket = navVelNed.packetStatus; |
272 | break; |
330 | break; |
- | 331 | */ |
|
- | 332 | ||
273 | default: |
333 | default: |
274 | ignorePacket = 1; |
334 | ignorePacket = 1; |
275 | ubxSp = (char*)0; |
335 | ubxSp = (char*)0; |
276 | } |
336 | } |
277 | break; |
337 | break; |