diff options
author | Darryl Taylor <darryl.c.taylor@gmail.com> | 2013-07-09 17:07:11 +0800 |
---|---|---|
committer | Darryl Taylor <darryl.c.taylor@gmail.com> | 2013-07-09 17:07:11 +0800 |
commit | dc2ef7b3c6e1ee90ba2130ed0574987d5c99a35b (patch) | |
tree | 4c1a317a311944aa34f730af506b69d6d3d9e595 | |
parent | 6dff71668d96be4b63c55c41a8884014bbfdfdce (diff) | |
download | px4-firmware-dc2ef7b3c6e1ee90ba2130ed0574987d5c99a35b.tar.gz px4-firmware-dc2ef7b3c6e1ee90ba2130ed0574987d5c99a35b.tar.bz2 px4-firmware-dc2ef7b3c6e1ee90ba2130ed0574987d5c99a35b.zip |
Some cleanup of NAV_SVINFO message handler
-rw-r--r-- | src/drivers/gps/ubx.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/drivers/gps/ubx.cpp b/src/drivers/gps/ubx.cpp index b136dfc0a..ff8945da1 100644 --- a/src/drivers/gps/ubx.cpp +++ b/src/drivers/gps/ubx.cpp @@ -567,28 +567,20 @@ UBX::handle_message() memcpy(_rx_buffer_part2, &(_rx_buffer[length_part1 + i * length_part2]), length_part2); packet_part2 = (gps_bin_nav_svinfo_part2_packet_t *) _rx_buffer_part2; + /* Write satellite information to global storage */ + uint8_t sv_used = packet_part2->flags & 0x01; - /* Write satellite information in the global storage */ - _gps_position->satellite_prn[i] = packet_part2->svid; - - //if satellite information is healthy store the data - //DT uint8_t unhealthy = packet_part2->flags & 1 << 4; //flags is a bitfield - //DT Above is broken due to operator precedence. should be ... & (1<<4) or ... & 0x10. - //DT If an SV is unhealthy then it won't be used. - - uint8_t sv_used = packet_part2->flags & 0x01; - - if (sv_used) { - // Update count of SVs used for NAV. + if ( sv_used ) { + // Count SVs used for NAV. satellites_used++; } - // Record info for all used channels, whether or not the SV is used for NAV, + // Record info for all channels, whether or not the SV is used for NAV. _gps_position->satellite_used[i] = sv_used; _gps_position->satellite_snr[i] = packet_part2->cno; _gps_position->satellite_elevation[i] = (uint8_t)(packet_part2->elev); _gps_position->satellite_azimuth[i] = (uint8_t)((float)packet_part2->azim * 255.0f / 360.0f); - + _gps_position->satellite_prn[i] = packet_part2->svid; } for (i = packet_part1->numCh; i < 20; i++) { //these channels are unused |