Commit Graph

110 Commits

Author SHA1 Message Date
Lucas De Marchi df5652fa87 AP_Baro: use functor macros
Functor is not yet being used but let's make is macro fallback to the
previous Delegate implementation for easy of transition between the two.
2015-05-26 13:46:52 +10:00
Andrew Tridgell 3320dfd7fa AP_Baro: fixed ms5611 spelling error 2015-01-09 11:59:49 +11:00
Andrew Tridgell 8359c082ca AP_Baro: fixed baro on NavIO
don't use the 1kHz timer as it conflicts with other I2C devices
2015-01-09 11:51:51 +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
Staroselskii Georgii 43c88c37eb AP_Baro: fixed MS5611 initialisation in order to get rid off conflicts with other I2C devices 2015-01-07 08:41:13 +11:00
Andrew Tridgell 8b794602d1 AP_Baro: make get_temperature() a const function 2014-11-12 13:36:01 +11:00
Andrew Tridgell d01fa3bfbd AP_Baro: prevent reading the MS5611 too fast
setup the timer start after we've started the conversion to prevent
reading faster than the MS5611 is able to produce values
2014-08-19 21:16:13 +10:00
Randy Mackay 24db492131 Baro_MS5611: use healthy flag 2014-08-14 16:03:06 +09:00
Mikhail Avkhimenia 83bbee491c AP_Baro_MS5611: add address switch for Navio board 2014-08-12 22:09:29 +10:00
Andrew Tridgell 2b3d17d955 AP_Baro: fixed APM1 build 2014-07-14 09:50:17 +10:00
Andrew Tridgell be02f0c34f AP_Baro: work around occasional 0 values from MS5611
this was seen on the PXF board. It isn't yet known why it happens
2014-07-14 09:44:36 +10:00
Andrew Tridgell f73ec95c39 AP_Baro_MS5611: added PROM CRC checking
disabled on APM2 to save flash space
2014-07-14 09:44:35 +10:00
Andrew Tridgell e118984c26 AP_Baro: save some flash and memory on APM2
we don't need the I2C MS5611 driver
2014-07-08 14:21:42 +10:00
Andrew Tridgell 8a65a729f3 AP_Baro: start MS5611 at high speed 2013-11-07 12:48:17 +11:00
Andrew Tridgell d60a68fd9c AP_Baro: check baro at exactly 100Hz
prevent waits for samples
2013-10-13 11:02:53 +09:00
Andrew Tridgell c04d9b0c03 AP_Baro: updates for AP_HAL::MemberProc 2013-09-30 21:06:42 +10:00
Andrew Tridgell 20b1131059 AP_Baro: use new scheduler API 2013-09-28 21:24:03 +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 97b7130bb9 libraries: update license header to GPLv3
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
James Bielman 5631f865b2 Update floating point calculations to use floats instead of doubles.
- Allows use of hardware floating point on the Cortex-M4.
- Added "f" suffix to floating point literals.
- Call floating point versions of stdlib math functions.
2013-01-16 13:52:01 +11:00
James Bielman 25d078e2bd AP_Baro_MS5611: Don't panic if taking semaphore fails during init.
- The MPU6000 holds on to the I2C semaphore for quite some time during
  init, which caused a panic when the MS5611 is also on I2C.
2013-01-10 14:22:41 -08:00
Andrew Tridgell 9b972af307 AP_Baro: skip timer if we don't get the SPI semaphore 2013-01-09 20:27:48 +11:00
James Bielman eca1417858 AP_HAL: Add semaphores to I2C driver.
- Guard I2C transactions with this semaphore in the MS5611 and
  HMC5843 drivers.
2013-01-04 15:43:43 -08:00
James Bielman d84ba8ef59 Use HAL suspend/resume timer procs rather than atomic.
- Preparation for removing begin/end atomic.
2013-01-03 17:33:13 -08:00
Pat Hickey 5d91f342bb AP_Baro_MS5611: uses new semaphore lib 2013-01-03 13:48:07 -08:00
James Bielman 5753ae5692 AP_Baro: Add I2C support to MS5611 driver. 2013-01-03 13:48:06 -08:00
Andrew Tridgell c5ba33d39a AP_Baro: fixed MS5611 semaphore handling 2012-12-21 19:33:57 +11:00
Pat Hickey 107ab1a694 AP_Baro: translated to SPI transactions 2012-12-20 14:52:32 +11:00
Pat Hickey 2c2279722b AP_Baro_MS5611: use scheduler panic 2012-12-20 14:52:31 +11:00
Pat Hickey bfd03ab40c AP_Baro: robust spi device 2012-12-20 14:51:35 +11:00
Pat Hickey eaa0a990a4 AP_Baro: MS5611 robust semaphores 2012-12-20 14:51:35 +11:00
Pat Hickey 52925b655f AP_Baro: MS5611 uses delay in busy wait 2012-12-20 14:51:35 +11:00
Pat Hickey c1114168e4 AP_Baro tests rebase fixups 2012-12-20 14:51:29 +11:00
Pat Hickey 668caa4a2e Fix calls to AP_HAL::Scheduler::register_timer_process 2012-12-20 14:51:27 +11:00
Pat Hickey 5d40074e4e AP_Baro: port to AP_HAL 2012-12-20 14:51:26 +11:00
Andrew Tridgell e331634bc5 AP_Baro: switch to SREG = oldSREG pattern for interrupt mask/restore 2012-11-20 22:31:17 +11:00
Andrew Tridgell e5846bd965 AP_Baro: removed _sync_access check
this isn't needed as the common variables are already protected by
cli()/sei()
2012-09-20 17:34:33 +10:00
uncrustify b0003c020f uncrustify libraries/AP_Baro/AP_Baro_MS5611.cpp 2012-08-21 19:00:18 -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 057eb5e6f6 Baro: average over all pressure/temperature samples on MS5611
this allows us to use the MS5611 barometer at its full 100Hz sample
rate (80Hz for pressure, 20Hz for temperature). The pressure and
temperature values are averaged between reads without adding any
latency. Previously the driver would throw away values between
readings

This also fixes a race condition in reading from the SPI bus that
could lead to bad values from the barometer
2012-07-02 13:44:53 +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
Andrew Tridgell 88b2139d91 Baro: added suspend/resume on init 2012-05-01 12:06:54 +10:00
justinbeech 62b104cbfa Found free extra 256 bytes of RAM eliminate _clz use from libgcc
Believe it or not, changing / 2^31 to >>31 saved 256 bytes in the "d" segment.

The reason is that GCC version prior to 4.3.5 does not have a count_leading_zeros (clz) assembler macro, so it uses a 256 byte lookup table called _clz
The _clz table gets pulled in if you do 64 bit division.
This tiny change is the only place that we do long long division.
Changing to a shift saves 256 bytes of ram.
2012-02-17 09:46:05 +00:00
Jason Short 026e4a6567 change constant to float 44330.0 2012-02-15 09:10:14 -08:00
Andrew Tridgell 804332c340 AP_Baro: fixed some signed/unsigned warnings
and a potential bug on timer wrap
2012-02-13 21:39:18 +11:00
justinbeech 69f1613f2c Uncommented cold temp compensation after testing. Fixed read throttle so read rate ends up nailing 100hz, not 90hz. minor commenting improvements. 2012-02-13 00:00:06 +00: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
Andrew Tridgell e7720254dd AP_Baro: update MS5611 driver for new ap_proceduce prototype
this saves calling millis() quite so often
2011-12-21 23:31:38 +11:00
Andrew Tridgell bb0f179495 AP_Baro: fixed temperature on MS5611
this caused a 2x scaling of altitude
2011-12-17 14:58:58 +11:00
Pat Hickey f4aaa56b16 AP_Baro_MS5611: Asynchronous operation, plus c++ style changes.
Yeah, I know this was a big change to make all at once.
2011-12-11 15:21:10 -08: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 f3ad7f3af8 Wire and SPI Init: move to sketch system.pde from libraries
* Wire.begin removed from AP_Baro_BMP085::init()
* SPI.begin  removed from AP_Baro_MS5611::init()
* SPI.begin  removed from AP_InertialSensor_MPU6000::hardware_init()

* Both Wire.begin and SPI.begin added very early in init_ardupilot in
  ArduCopter/system.pde and ArduPlane/system.pde
2011-12-11 15:21:10 -08:00
Pat Hickey f52453beed AP_Baro_MS5611: init must also perform SPI.begin 2011-12-11 15:21:09 -08:00
Pat Hickey 64eb1889ab AP_Baro_MS5611: CS pin is arduino pin 40 2011-12-11 15:21:09 -08:00
Pat Hickey 1832ed0355 AP_Baro_MS5611: Implement AP_Baro interface 2011-12-11 15:21:09 -08:00
Pat Hickey fdffd69257 AP_Baro_MS5611: renamed class implementation from APM_MS5611 2011-12-11 15:21:09 -08:00
Pat Hickey c407b0d85e AP_Baro_MS5611.h: reorganized
* moved ms5611 macros to c file
* reorganized class declaration & retabbed
* made Temp, Pres, and Alt private variables.
2011-12-11 15:21:09 -08:00
Pat Hickey 34cebd8a3e AP_Baro_MS5611: Overwrote with Jose Julio's latest files. 2011-12-11 15:21:09 -08:00
Pat Hickey 9250053bfe Added AP_Baro and AP_Baro_MS5611 classes.
Incomplete and does not work.
2011-12-11 15:21:08 -08:00