UBlox: Only use time and date if flags are valid

This commit is contained in:
Johan Jansen
2015-04-07 17:15:33 +02:00
parent a121f6101f
commit 891a7af509
+4
View File
@@ -747,6 +747,10 @@ UBX::payload_rx_done(void)
_gps_position->cog_rad = (float)_buf.payload_rx_nav_pvt.headMot * M_DEG_TO_RAD_F * 1e-5f;
_gps_position->c_variance_rad = (float)_buf.payload_rx_nav_pvt.headAcc * M_DEG_TO_RAD_F * 1e-5f;
//Check if time and date fix flags are good
if( (_buf.payload_rx_nav_pvt.valid & UBX_RX_NAV_PVT_VALID_VALIDDATE)
&& (_buf.payload_rx_nav_pvt.valid & UBX_RX_NAV_PVT_VALID_VALIDTIME)
&& (_buf.payload_rx_nav_pvt.valid & UBX_RX_NAV_PVT_VALID_FULLYRESOLVED))
{
/* convert to unix timestamp */
struct tm timeinfo;