diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2014-05-19 22:41:54 +0200 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2014-05-19 22:41:54 +0200 |
commit | b250e28abfaf4d1adc8bdfb815fff369e0e41cc6 (patch) | |
tree | 15356bf627b5e869ad0dd37fb63bacf3870170c6 | |
parent | 98f05ea5c127acd3d8ff0ebcba109f9e326a129b (diff) | |
parent | f0630547aa6d391fbb056e450d2344bd888721e2 (diff) | |
download | px4-firmware-b250e28abfaf4d1adc8bdfb815fff369e0e41cc6.tar.gz px4-firmware-b250e28abfaf4d1adc8bdfb815fff369e0e41cc6.tar.bz2 px4-firmware-b250e28abfaf4d1adc8bdfb815fff369e0e41cc6.zip |
Merge pull request #978 from PX4/mtk_fix
Mtk fix
-rw-r--r-- | src/drivers/gps/mtk.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/drivers/gps/mtk.cpp b/src/drivers/gps/mtk.cpp index c90ecbe28..680f00d97 100644 --- a/src/drivers/gps/mtk.cpp +++ b/src/drivers/gps/mtk.cpp @@ -249,12 +249,18 @@ MTK::handle_message(gps_mtk_packet_t &packet) warnx("mtk: unknown revision"); _gps_position->lat = 0; _gps_position->lon = 0; + + // Indicate this data is not usable and bail out + _gps_position->eph_m = 1000.0f; + _gps_position->epv_m = 1000.0f; + _gps_position->fix_type = 0; + return; } _gps_position->alt = (int32_t)(packet.msl_altitude * 10); // from cm to mm _gps_position->fix_type = packet.fix_type; - _gps_position->eph_m = packet.hdop; // XXX: Check this because eph_m is in m and hdop is without unit - _gps_position->epv_m = 0.0; //unknown in mtk custom mode + _gps_position->eph_m = packet.hdop / 100.0f; // from cm to m + _gps_position->epv_m = _gps_position->eph_m; // unknown in mtk custom mode, so we cheat with eph _gps_position->vel_m_s = ((float)packet.ground_speed) * 1e-2f; // from cm/s to m/s _gps_position->cog_rad = ((float)packet.heading) * M_DEG_TO_RAD_F * 1e-2f; //from deg *100 to rad _gps_position->satellites_visible = packet.satellites; |