GPS: fixes after review

Ensure 3D fix before returning velocity_down
UBLOX: restore check of fix_status as part of determining 2D or 3D fix
SIRF: add missing brackets on fix type check
This commit is contained in:
Randy Mackay 2013-03-25 19:08:47 +09:00 committed by rmackay9
parent c2055557f5
commit 27309a553f
3 changed files with 20 additions and 10 deletions

View File

@ -174,7 +174,7 @@ AP_GPS_SIRF::_parse_gps(void)
// parse fix type
if (_buffer.nav.fix_invalid) {
fix = GPS::FIX_NONE;
}else if (_buffer.nav.fix_type & FIX_MASK == FIX_3D) {
}else if ((_buffer.nav.fix_type & FIX_MASK) == FIX_3D) {
fix = GPS::FIX_3D;
}else{
fix = GPS::FIX_2D;

View File

@ -228,7 +228,8 @@ AP_GPS_UBLOX::_parse_gps(void)
Debug("MSG_STATUS fix_status=%u fix_type=%u",
_buffer.status.fix_status,
_buffer.status.fix_type);
if (_buffer.status.fix_type == AP_GPS_UBLOX::FIX_3D) {
if (_buffer.status.fix_status & NAV_STATUS_FIX_VALID) {
if( _buffer.status.fix_type == AP_GPS_UBLOX::FIX_3D) {
next_fix = GPS::FIX_3D;
}else if (_buffer.status.fix_type == AP_GPS_UBLOX::FIX_2D) {
next_fix = GPS::FIX_2D;
@ -236,12 +237,17 @@ AP_GPS_UBLOX::_parse_gps(void)
next_fix = GPS::FIX_NONE;
fix = GPS::FIX_NONE;
}
}else{
next_fix = GPS::FIX_NONE;
fix = GPS::FIX_NONE;
}
break;
case MSG_SOL:
Debug("MSG_SOL fix_status=%u fix_type=%u",
_buffer.solution.fix_status,
_buffer.solution.fix_type);
if (_buffer.status.fix_type == AP_GPS_UBLOX::FIX_3D) {
if (_buffer.status.fix_status & NAV_STATUS_FIX_VALID) {
if( _buffer.status.fix_type == AP_GPS_UBLOX::FIX_3D) {
next_fix = GPS::FIX_3D;
}else if (_buffer.status.fix_type == AP_GPS_UBLOX::FIX_2D) {
next_fix = GPS::FIX_2D;
@ -249,6 +255,10 @@ AP_GPS_UBLOX::_parse_gps(void)
next_fix = GPS::FIX_NONE;
fix = GPS::FIX_NONE;
}
}else{
next_fix = GPS::FIX_NONE;
fix = GPS::FIX_NONE;
}
num_sats = _buffer.solution.satellites;
hdop = _buffer.solution.position_DOP;
break;

View File

@ -141,7 +141,7 @@ public:
return _status >= GPS_OK_FIX_2D ? _velocity_east : 0;
}
float velocity_down(void) {
return _status >= GPS_OK_FIX_2D ? _velocity_down : 0;
return _status >= GPS_OK_FIX_3D ? _velocity_down : 0;
}
// last ground speed in m/s. This can be used when we have no GPS