Commit Graph

39 Commits

Author SHA1 Message Date
Lucas De Marchi 5472bc4de1 Global: change Device::PeriodicCb signature
Remove bool return as it's never being used and not supported on PX4.
2017-01-14 10:03:54 +11:00
Andrew Tridgell bedee31f61 AP_Baro: fixed semaphore and thread usage in baro drivers 2016-11-09 17:08:02 +11:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Lucas De Marchi 3c7d80a270 AP_Baro: BMP085: use a moving average of 10 samples in BMP085
Instead of depending on the frequency accumulate() is called, use
AverageIntegralFilter with 10 samples. The data obtained by BMP085 is
too noisy with any value of OVERSAMPLING so use twice the number of
samples as currently used. Besides that now we are sure there's always
10 samples used in the average.
2016-05-10 14:24:59 -03:00
Lucas De Marchi 8da5275b03 AP_Baro: BMP085: don't average temperature in BMP085
The temperature readings is not subject to white noise so there's no
point in averaging its reading. Moreover since for a normal 50Hz
accumulate() / 10Hz update() it would read temperature only once per
update(), it's pointless to keep averaging and introducing rounding
error.

The temperature doesn't need to be checked as frequent as pressure, too.
The datasheet even suggests on section 3.3, page 10 to enable standard
mode and read the temperature at 1Hz. Here we reduce it to 2Hz
(considering the accumulate() function being called at 50Hz).
2016-05-10 14:24:59 -03:00
Lucas De Marchi c5c52076ca AP_Baro: BMP085: rename private member 2016-05-10 14:24:58 -03:00
Lucas De Marchi e40b88aa70 AP_Baro: BMP085: use DigitalSource interface in BMP085
Use the DigitalSource interface rather than going through the "static"
interface hal.gpio provides
2016-05-10 14:24:58 -03:00
Lucas De Marchi b05954660a AP_Baro: BMP085: use I2CDevice interface 2016-02-16 19:49:09 -02:00
Lucas De Marchi 8eee888b3e AP_Baro: BMP085: move data-ready macro to a method 2015-12-02 10:40:50 +11:00
Lucas De Marchi c5e97129c1 AP_Baro: BMP085: follow coding style
- Spacing changes and variable renames to follow coding style
 - No need to initialize variables to 0, it's already done by our
   global new operator.
2015-12-02 10:40:50 +11:00
Lucas De Marchi 81a298c9c8 AP_Baro: reduce header scope
We don't need to expose to other libraries how each backend is
implemented. AP_Baro.h is the main header, included by other libraries.

Instead of including each backend in the main header, move them to where
they are needed. Additionally standardize the order and how we include
the headers.

The advantages are:
	- Internals of each backend is not exposed outside of the
	  library
	- Faster incremental builds since we don't need to recompile
	  whoever includes AP_Baro.h because a backend changed
2015-12-02 10:40:50 +11:00
Andrew Tridgell f1891cea1f AP_Baro: BMP085 driver done, but untested 2015-01-09 11:50:54 +11:00
Andrew Tridgell 5bb57a31f7 AP_Baro: split into frontend/backend
this allows for support of multiple sensors on a board
2015-01-09 11:50:54 +11:00
Andrew Tridgell 8b794602d1 AP_Baro: make get_temperature() a const function 2014-11-12 13:36:01 +11:00
Randy Mackay af28b74944 Baro_BMP085: init members to resolve compiler warnings 2014-08-14 11:27:29 +09:00
Mike McCauley e3c20f06ac AP_Baro: Chnages to flymaple port.
Flymaple has no EOC pin
2013-09-24 13:33:25 +10:00
Andrew Tridgell fc119d9b80 AP_Baro: cleaned up temperature and pressure units
thanks to Mike McCauley for pointing this out
2013-09-21 21:30:41 +10:00
Andrew Tridgell 8ceabc97f1 AP_Baro: added accumulate() function
this allows us to read the BMP085 much faster
2013-01-09 23:05:17 +11:00
Andrew Tridgell 4a54ffb523 Baro: use local include to reduce boilerplate 2012-12-20 14:52:30 +11:00
Andrew Tridgell dbd9814327 AP_Baro: get rid of apm2_hardware parameter in init 2012-12-20 14:51:38 +11:00
Pat Hickey 5d40074e4e AP_Baro: port to AP_HAL 2012-12-20 14:51:26 +11:00
uncrustify cfcef93e16 uncrustify libraries/AP_Baro/AP_Baro_BMP085.h 2012-08-21 19:00:50 -07:00
Andrew Tridgell f501503eb0 AP_Baro: improved barometer averaging
this changes the barometer calculations to floating point. On a MS5611
this is actually about twice as fast as the previous 64 bit
calculations, but gains us more accuracy as we are able to take
advantage of sub-bit precision when we average over 8 samples.
2012-07-06 15:11:30 +10:00
Andrew Tridgell 209136386b AP_Baro: added get_pressure_samples() interface
this returns how many samples were used to calculate the last pressure
2012-07-05 16:29:21 +10:00
Andrew Tridgell c387edd74c Baro: added get_altitude() and get_climb_rate() interfaces
this allows the barometer driver to calibrate and return altitude and
climb rate values. This will be used by the AHRS drift correction code
for vertical velocity

The climb rate uses a 5 point average filter
2012-06-27 16:01:50 +10:00
rmackay9 2d65ec2874 AP_Baro - change data type size of temperature's average filter to int32_t (was int16_t) 2012-03-24 23:21:11 +09:00
rmackay9 01cc5fe938 AP_Baro - removed unnecessary 2 element average filtering of pressure (there is a 4 or 5 element average filter in arducopter code itself, two places is messy)
- also removed unused _offset_press variable
2012-03-18 15:18:05 +09:00
rmackay9 7560242721 AP_Baro - added average filter for temperature to replace broken filter
- added average filter (for last two values) for raw pressure
        - changed some "long" to int32_t and "unsigned long" to uint32_t
2012-03-18 01:06:02 +09:00
Jason Short e57b91c2e2 Updated on Barometer - increased the Temp filtering and decreased the pressure filtering to and get less temp noise, faster response from pressure. I'm filtering the Climb rate differently now, so this higher pressure noise should not hurt the derivative calcs at all now. 2012-03-06 20:55:35 -08:00
rmackay9 d81c951849 AP_Baro - fixed small compiler warning to do with order of parameters in constructor 2012-02-29 22:46:29 +09:00
Andrew Tridgell 897d9a1c0b baro: fixed an integer overflow issue at high altitudes
the averaging array was using 16 bit numbers, but we are storing
numbers with 19 significant bits. That caused overflow at high
altitude, and some very interesting altitude graphs!

Thanks to Michael Oborne for spotting this in a log
2012-01-14 19:51:35 +11:00
Andrew Tridgell 9fb3b13af3 AP_Baro: when I2c fails, don't retry for 1s 2012-01-04 16:35:16 +11:00
Andrew Tridgell 7ba744a11a I2C: convert barometer library to new I2C library
this also adds a healthy attribute and error checking
2011-12-28 20:41:53 +11:00
Pat Hickey d026e48032 AP_Baro : Add init( AP_PeriodicProcess * ) method to interface & implementations
AP_Baro_MS5611 and AP_Baro_BMP085 implement the interface, with stubs only
2011-12-11 15:21:10 -08:00
Pat Hickey a626e21e98 AP_Baro_BMP085: move apm2_hardware flag from init to constructor. 2011-12-11 15:21:10 -08:00
Pat Hickey f0ab0318b3 AP_Baro_BMP085: Conform to AP_Baro interface. Make the rest private. 2011-12-11 15:21:09 -08:00
Pat Hickey f445ec1242 AP_Baro_BMP085(+_HIL): Rename classes from APM_BMP085 to AP_Baro_BMP085. 2011-12-11 15:21:09 -08:00
Pat Hickey 7032c32b42 BMP085 fix line endings 2011-12-11 15:21:09 -08:00
Pat Hickey 7ef146044e AP_Baro: move all APM_BMP085 files inside AP_Baro 2011-12-11 15:21:09 -08:00