Commit 8abc9572 authored by Error414's avatar Error414

fix union

parent 168d5616
......@@ -27,6 +27,16 @@ enum PROTOCOL_BYTES {
MSG_VELNED = 0x12
};
struct ubxPosllh {
uint32_t time; // GPS msToW
int32_t longitude;
int32_t latitude;
int32_t altitude_ellipsoid;
int32_t altitude_msl;
uint32_t horizontal_accuracy;
uint32_t vertical_accuracy;
};
struct ubxSolution {
uint32_t time;
int32_t time_nsec;
......@@ -109,6 +119,7 @@ class GPS{
uint8_t _class;
resultGps result;
union {
ubxPosllh posllh;
ubxSolution solution;
ubxVelned velned;
uint8_t bytes[];
......@@ -216,6 +227,9 @@ void GPS::processGPS(){
bool GPS::UBLOXParseGps() {
switch (_msgID) {
case MSG_SOL:
Serial.println(_buffer.solution.fix_status);
if ((_buffer.solution.fix_status & NAV_STATUS_FIX_VALID) && (_buffer.solution.fix_type == FIX_3D || _buffer.solution.fix_type == FIX_2D)){
result.GPS_fix_type = _buffer.solution.fix_type;
}
......
......@@ -35,6 +35,9 @@ GPS gps(&GPSConnection);
Speed speed;
void setup(){
Serial.begin(115200);
screen.init();
screen.showMainScreen();
screen.showPrewMaxSpeed(speed.getMaxPrewSpeed());
......@@ -49,7 +52,10 @@ void loop(){
screen.showFixType(data->GPS_fix_type);
screen.showSat(data->GPS_numSat);
speed.setSpeed(data->GPS_speed);
screen.showMaxSpeed(speed.getMaxSpeed());
if(data->GPS_fix_type == FIX_3D){
speed.setSpeed(data->GPS_speed);
screen.showMaxSpeed(speed.getMaxSpeed());
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment