mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
ahrs: Only read mag data when it has been updated
The AHRS mainloop was reading the mag data on every loop regardless of whether new data was actually available. Now that the MAG_DRDY signal is monitored, we can read only at the rate (10Hz) new data is actually produced by the sensor. This also enables future improvements that will remove the filtering work that is still being done on the mag data on every iteration. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1630 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
55d90970ed
commit
cdb8aa37a0
@ -194,7 +194,6 @@ static uint8_t adc_oversampling = 15;
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief AHRS Main function
|
||||
*/
|
||||
@ -294,8 +293,10 @@ int main()
|
||||
}
|
||||
|
||||
#if defined(PIOS_INCLUDE_HMC5843) && defined(PIOS_INCLUDE_I2C)
|
||||
// Get magnetic readings
|
||||
PIOS_HMC5843_ReadMag(mag_data.raw.axis);
|
||||
// Get magnetic readings
|
||||
if (PIOS_HMC5843_NewDataAvailable()) {
|
||||
PIOS_HMC5843_ReadMag(mag_data.raw.axis);
|
||||
}
|
||||
#endif
|
||||
// Delay for valid data
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user