Subversion Repositories NaviCtrl

Rev

Rev 119 | Rev 171 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 119 Rev 146
Line 168... Line 168...
168
// local buffers for the incomming ubx messages
168
// local buffers for the incomming ubx messages
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
 
-
 
173
u32 CheckGPSOkay = 0;
-
 
174
 
172
 
175
// shared buffer
173
// shared buffer
176
gps_data_t              GPSData = {{0,0,0,INVALID},0,0,0,0,0,0,0, INVALID};
174
gps_data_t              GPSData = {{0,0,0,INVALID},0,0,0,0,0,0,0, INVALID};
Line -... Line 175...
-
 
175
DateTime_t                      GPSDateTime = {0,0,0,0,0,0,0, INVALID};
-
 
176
 
Line 177... Line 177...
177
DateTime_t                      GPSDateTime = {0,0,0,0,0,0,0, INVALID};
177
#define UBX_TIMEOUT 500 // 500 ms
178
 
178
u32 UBX_Timeout = 0;
Line 179... Line 179...
179
 
179
 
Line 268... Line 268...
268
        // mark msg buffers invalid
268
        // mark msg buffers invalid
269
        UbxSol.Status = INVALID;
269
        UbxSol.Status = INVALID;
270
        UbxPosLlh.Status = INVALID;
270
        UbxPosLlh.Status = INVALID;
271
        UbxVelNed.Status = INVALID;
271
        UbxVelNed.Status = INVALID;
272
        GPSData.Status = INVALID;
272
        GPSData.Status = INVALID;
-
 
273
 
-
 
274
        UBX_Timeout = SetDelay(2 * UBX_Timeout);
273
}
275
}
Line 274... Line 276...
274
 
276
 
275
/********************************************************/
277
/********************************************************/
276
/*            Upate GPS data stcructure                 */
278
/*            Upate GPS data stcructure                 */
277
/********************************************************/
279
/********************************************************/
278
void Update_GPSData (void)
280
void Update_GPSData (void)
279
{
281
{
280
        static u32 Ubx_Timeout = 0;
282
        static u32 Msg_Count_Timeout = 0;
Line 281... Line 283...
281
        static u8 Msg_Count = 0;
283
        static u8 Msg_Count = 0;
282
 
284
 
283
        // the timeout is used to detect the delay between two message sets
285
        // the timeout is used to detect the delay between two message sets
284
        // and is used for synchronisation so that always a set is collected
286
        // and is used for synchronisation so that always a set is collected
285
        // that belongs together
287
        // that belongs together
286
        // _______NAVSOL|POSLLH|VELNED|___________________NAVSOL|POSLLH|VELNED|_____________
288
        // _______NAVSOL|POSLLH|VELNED|___________________NAVSOL|POSLLH|VELNED|_____________
Line 287... Line 289...
287
        //              |  8ms | 8ms  |         184 ms          |      |      |
289
        //              |  8ms | 8ms  |         184 ms          |      |      |
288
        // msg_count:   0      1      2                         0      1      2
290
        // msg_count:   0      1      2                         0      1      2
289
 
291
 
Line 290... Line 292...
290
        if(CheckDelay(Ubx_Timeout))     Msg_Count = 0;
292
        if(CheckDelay(Msg_Count_Timeout))       Msg_Count = 0;
291
        else Msg_Count++;
293
        else Msg_Count++;
292
        Ubx_Timeout = SetDelay(100); // reset ubx msg timeout
294
        Msg_Count_Timeout = SetDelay(100); // reset ubx msg timeout
293
 
295
 
294
        // if a new set of ubx messages was collected
296
        // if a new set of ubx messages was collected
295
        if((Msg_Count >= 2))
297
        if((Msg_Count >= 2))
296
        {       // if set is complete
298
        {       // if set is complete
297
                if((UbxSol.Status == NEWDATA) && (UbxPosLlh.Status == NEWDATA) && (UbxVelNed.Status == NEWDATA))
299
                if((UbxSol.Status == NEWDATA) && (UbxPosLlh.Status == NEWDATA) && (UbxVelNed.Status == NEWDATA))
298
                {
300
                {
299
                        CheckGPSOkay++;
301
                        UBX_Timeout = SetDelay(UBX_TIMEOUT);
300
                        DebugOut.Analog[9]++;
302
                        DebugOut.Analog[9]++;