3,6 → 3,9 |
#include "main.h" |
#include <avr/io.h> |
|
#include "uart.h" |
#include "timer0.h" |
|
// ubx protocol parser state machine |
#define UBXSTATE_IDLE 0 |
#define UBXSTATE_SYNC1 1 |
105,9 → 108,9 |
GPSInfo.veltop = -GpsVelNed.VEL_D; |
GpsPosUtm.Status = PROCESSED; // never update old data |
} |
if (GpsStatus.Status | GpsVelNed.Status | GpsPosLlh.Status | GpsPosUtm.Status) |
if (GpsStatus.Status != INVALID) |
{ |
GPSInfo.status = VALID; |
GPSInfo.status = VALID; // set valid if data are updated |
} |
} |
|
143,13 → 146,12 |
ubxP = (int8_t *)&GpsPosUtm; // data start pointer |
ubxEp = (int8_t *)(&GpsPosUtm + sizeof(GPS_POSUTM_t)); // data end pointer |
ubxSp = (int8_t *)&GpsPosUtm.Status; // status pointer |
|
break; |
|
case UBX_ID_POSLLH: // geodetic position |
ubxP = (int8_t *)&GpsStatus; // data start pointer |
ubxEp = (int8_t *)(&GpsStatus + sizeof(GPS_STATUS_t)); // data end pointer |
ubxSp = (int8_t *)&GpsStatus.Status; // status pointer |
ubxP = (int8_t *)&GpsPosLlh; // data start pointer |
ubxEp = (int8_t *)(&GpsPosLlh + sizeof(GPS_POSLLH_t)); // data end pointer |
ubxSp = (int8_t *)&GpsPosLlh.Status; // status pointer |
break; |
|
case UBX_ID_STATUS: // receiver status |
206,17 → 208,24 |
|
case UBXSTATE_CKA: |
if (c == cka) ubxstate = UBXSTATE_CKB; |
else ubxstate = UBXSTATE_IDLE; |
else |
{ |
*ubxSp = INVALID; |
ubxstate = UBXSTATE_IDLE; |
} |
break; |
|
case UBXSTATE_CKB: |
if (c == ckb) |
{ |
*ubxSp = VALID; // new data are availabe |
*ubxSp = VALID; // new data are valid |
ROT_FLASH; |
UpdateGPSInfo(); //update GPS info respectively |
ROT_FLASH; |
|
} |
else |
{ // if checksum not fit then set data invalid |
*ubxSp = INVALID; |
} |
ubxstate = UBXSTATE_IDLE; // ready to parse new data |
break; |
|