Commit Graph

604 Commits

Author SHA1 Message Date
Jonathan Challinger c45ca690dc AP_Baro: make crc4 a static member of AP_Baro_MS56xx 2019-04-24 11:45:14 +10:00
Andrew Tridgell 8d57a6a86a AP_Baro: skip cal on watchdog reset 2019-04-22 16:53:35 +10:00
Andrew Tridgell fef42c6219 AP_Baro: fixes for LPS2XH driver
use fractional temperature, and check status register to ensure we
have data available
2019-04-08 12:52:19 +10:00
Peter Barker 10cc05c8ed AC_Baro: add floating point constant designators 2019-04-05 23:04:17 -07:00
Michael du Breuil fd8f70c098 AP_Baro: Include AP_Logger directly 2019-04-05 20:12:53 +11:00
Sagnik Bhattacharya 1830e72a0e AP_Baro: add more comments to example 2019-04-02 19:41:45 +11:00
Tom Pittenger b54da9aab8 AP_Baro: rename dataflash to logger 2019-03-28 16:40:57 +11:00
mirkix 655421c526 AP_Baro: remove unused field 2019-03-25 08:26:49 +11:00
Andrew Tridgell c31ee1f71b AP_Baro: setup for fmuv6 2019-02-26 16:18:26 +11:00
Peter Barker 5e6f02f51e AP_Baro: uavcan: reindent after WITH_SEMAPHORE change (NFC) 2019-02-16 14:33:11 +11:00
Peter Barker 78f05492d7 AP_Baro: uavcan: use WITH_SEMAPHORE in place of give/take _registry 2019-02-16 14:33:11 +11:00
Tom Pittenger 52887e1c45 AP_Baro: unify singleton naming to _singleton and get_singleton() 2019-02-10 19:09:58 -07:00
Andrew Tridgell 14172d69d5 AP_Baro: removed F4Light 2019-01-21 21:57:21 +11:00
Peter Barker 6fc76a32af GLOBAL: use AP::logger() and strip redundant Log_ from methods 2019-01-18 18:08:20 +11:00
Peter Barker b47733142f GLOBAL: rename DataFlash_Class to AP_Logger 2019-01-18 18:08:20 +11:00
DOMINATOR\Eugene c56188d081 AP_Baro: read temperature from AP_Airspeed singleton 2018-11-17 07:52:42 +11:00
Peter Barker ee07789383 AP_Baro: add override keyword 2018-11-08 11:30:12 +11:00
Michael du Breuil c712e926d7 AP_Baro: Avoid returning 0.0f for EAS2TAS 2018-11-06 13:44:18 +11:00
Andrew Tridgell e4e793b295 AP_Baro: use WITH_SEMAPHORE()
and removed usage of hal.util->new_semaphore()
2018-10-17 12:54:22 +11:00
Peter Barker e503df48ff AP_Baro: emit calibrated messages for each connected baro
Thanks to OlliW for pointing this out
2018-10-15 08:13:50 +11:00
Eugene Shamaev 95ea3d8726 AP_Baro: fix temperature 2018-10-12 21:53:08 +01:00
murata 2d4dd1643d AP_Baro: Delete the total temperature process.
AP_Baro: Delete the total temperature process.
2018-10-12 12:05:17 +11:00
Peter Barker d05ab1b983 AP_Baro: notify GCS of all barometer ground pressures 2018-10-11 08:05:05 +11:00
Andrew Tridgell d79386d574 AP_Baro: use GND_EXT_BUS to allow a specific bus to be probed 2018-09-07 08:36:02 +10:00
Andrew Tridgell dda8e7c35a AP_Baro: probe both i2c buses on CubeBlack for barometers 2018-09-07 08:36:02 +10:00
Randy Mackay af6e2d2c8c AP_Baro: add PROBE_EXT param values
this makes it easier for users to select the external baro they want to use on GCSs that do not display the bitmasks
2018-09-07 08:36:02 +10:00
Randy Mackay 758331612f AP_Baro: probe for MS5611 on I2C addr 0x76 2018-09-07 08:36:02 +10:00
Andrew Tridgell 5de199bc01 AP_Baro: allow for external i2c baro on most boards
only disable on those with HAL_MINIMIZE_FEATURES enabled
2018-09-06 07:21:30 +10:00
Siddharth Purohit 5ef5537371 AP_Baro: move Baro UAVCAN subscribers and handlers to AP_Baro_UAVCAN 2018-08-29 22:54:59 +01:00
Andrew Tridgell 3fd25ad548 AP_Baro: added HAL_BARO_ALLOW_INIT_NO_BARO 2018-08-23 13:29:59 +10:00
Andrew Tridgell 1439b1a730 AP_Baro: added option to probe any i2c baro using GND_PROBE_EXT
This adds a hwdef.dat define HAL_PROBE_EXTERNAL_I2C_BAROS. When set,
we get a new parameter GND_PROBE_EXT that is a bitmask of i2c
barometers to look for.

This allows boards that have no builtin baro to work without
rebuilding
2018-08-23 13:29:59 +10:00
Andrew Tridgell f937589810 AP_Baro: fixed BMP085 probe 2018-08-23 13:29:59 +10:00
Andrew Tridgell b2cc992e0c AP_Baro: convert to use WITH_SEMAPHORE() 2018-08-23 08:21:48 +10:00
Francisco Ferreira 9489ec9e7c
AP_Baro: adapt to changes in AP_BoardConfig_CAN 2018-08-12 13:35:02 +01:00
Andrew Tridgell 769c99d4d7 AP_Baro: added register checking on BMP280
this follows a log which seems to show an in-flight register
corruption on a MatekF405
2018-08-04 16:44:08 +10:00
heitiane 2c24bac79e BARO_generic: add Dummy GCS to meet the requirement of AP_Baro::calibrate(). 2018-07-14 10:32:51 +10:00
Patrick José Pereira 4ae6bd2c7e AP_Baro: Use SITL singleton
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2018-06-26 00:02:01 +01:00
Eugene Shamaev 13954f97cf AP_Baro: helper func 2018-06-09 22:46:48 -07:00
Eugene Shamaev f8da16d11a AP_Baro: reducing indenting by linearizing the logic 2018-06-09 22:46:48 -07:00
Andrew Tridgell ae1a58ecb8 AP_Baro: added FMUv5 support 2018-06-06 07:15:41 +10:00
Patrick José Pereira b014b6c857 AP_Baro: Use SSL variables
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2018-05-23 02:36:43 +01:00
Eugene Shamaev 31628ea52f AP_Baro: functions declaration
Co-authored-by: Francisco Ferreira <OXINARF@users.noreply.github.com>
2018-05-22 08:35:01 +09:00
Francisco Ferreira de73ab6472 AP_Baro: remove Qualcomm board support 2018-05-17 09:57:20 +10:00
night-ghost 0b3514c519 AP_Baro: add support for BMP280 on alternate address 2018-05-16 18:55:29 +10:00
Patrick José Pereira f22f053c83 AP_Baro: Use C_TO_KELVIN
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2018-05-11 10:46:19 +10:00
Patrick José Pereira cc590ee587 AP_Baro: Add BARO_TYPE_WATER model to SITL when running for ArduSub
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2018-05-10 16:05:58 -04:00
Patrick José Pereira c7f832e81f AP_Baro: Add SimpleUnderWaterAtmosphere function
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2018-05-10 16:05:58 -04:00
Andrew Tridgell 86e85a7089 AP_Baro: fixed build warning 2018-05-07 11:43:23 +10:00
night-ghost eb0343649b Baro: fix HAL_F4light compilation errors 2018-04-30 08:32:58 +10:00
night-ghost 740e322438 AP_Baro: fix BMP280 scale 2018-04-13 20:45:48 +10:00
Peter Barker a5dc87e2af AP_Baro: do dataflash logging as part of update 2018-04-12 19:12:12 +01:00
night-ghost 33bdc9196c AP_Baro: added autodetection of popular baro types on external bus 2018-04-11 15:00:36 +10:00
night-ghost cb8a34f784 AP_Baro: added range filter to backend, use it in most sensors (thanks khancyr for style correction) 2018-04-11 14:46:42 +10:00
Peter Barker 1de68b78dc AP_Barometer: tidy handling of barometer calibrations 2018-04-02 23:25:05 +01:00
Peter Barker 0675f41d1e AP_Baro: create AP::baro() function 2018-03-08 21:20:05 -08:00
Andrew Tridgell 667093023c AP_Baro: added DPS280 barometer driver 2018-03-05 10:27:09 +00:00
Andrew Tridgell 5b7fe26f33 AP_Baro: added FBM320 driver 2018-03-05 10:27:09 +00:00
Andrew Tridgell 75a262ebf9 AP_Baro: support LPS25H on MPU9250 AUX 2018-03-02 12:52:50 +11:00
Andrew Tridgell 9e272b7a95 AP_Baro: support SP01 board 2018-02-14 18:27:00 +11:00
Andrew Tridgell f85c82ee5d AP_Baro: fixed baro scaling for LPS2XH 2018-02-14 18:27:00 +11:00
ljwang 88effef51a AP_Baro: support mini-pix using LPS25H SPI barometer
allow LPS22H and LPS25H to share a driver
2018-02-14 18:27:00 +11:00
Andrew Tridgell 00d3c158db AP_Baro: use generic defines for 20789 2018-02-08 17:36:33 +11:00
Andrew Tridgell 5a6831b606 AP_Baro: allow ICM-20789 on SPI or I2C 2018-02-08 17:36:33 +11:00
Andrew Tridgell a3dabf3c55 AP_Baro: enable 20789 baro on F412 2018-02-08 17:36:33 +11:00
Andrew Tridgell 472eed3847 AP_Baro: enable use of pressure correction
this allows for temperature correction of baro pressure
2018-02-08 17:36:33 +11:00
Andrew Tridgell b2172a0475 AP_Baro: support PCNC1 2018-02-08 17:36:33 +11:00
Peter Barker 12a3cc1179 AP_Baro: use Invensense defines when configuring ICM20789 IMU part 2018-02-08 17:36:33 +11:00
Peter Barker 3a0c5bed85 AP_Baro: ICM20789: example fixes 2018-02-08 17:36:33 +11:00
Peter Barker bf95be96f3 AP_Baro: ICM20789: stop dev_icm being an instance variable 2018-02-08 17:36:33 +11:00
Peter Barker c56486a39e AP_Baro: remove pointless destructor overrides 2018-02-08 17:36:33 +11:00
Peter Barker 05fb28c7f9 AP_Baro: use HAL_SEMAPHORE_BLOCK_FOREVER 2018-02-08 17:36:33 +11:00
Peter Barker ea83a487d4 AP_Baro: create BARO_ICM20789_DEBUG and use it 2018-02-08 17:36:33 +11:00
Peter Barker 31d8b6ba64 AP_Baro: do not take semaphore if HAL_INS_MPU60x0_NAME not set 2018-02-08 17:36:33 +11:00
Andrew Tridgell bf67153791 AP_Baro: implement ICM20789 barometer 2018-02-08 17:36:33 +11:00
Siddharth Purohit 175d806b5f AP_Baro: skip using posix headers for non-posix systems 2018-02-07 20:33:45 +11:00
Andrew Tridgell 83d1e71cb2 AP_Baro: ran BMP085 driver through code formatter 2018-02-05 12:12:03 +11:00
night-ghost 2c043b822b AP_Baro: fixed BMP085 driver for current API 2018-02-05 12:12:03 +11:00
LukeMike d48f9397d0 VRBRAIN / AP_Baro: added barometer sensor init for VR Brain boards 2018-02-05 08:26:49 +11:00
Andrew Tridgell 5846558b0e AP_Baro: moved constants to AP_Math/definitions.h 2018-01-16 07:14:20 +11:00
rde-mato 787420931e AP_Baro: make AP_Baro a singleton
for AP_Airspeed
2018-01-16 07:14:20 +11:00
Andrew Tridgell 51f9f087ab AP_Baro: support MindPX-v2 2018-01-15 11:46:02 +11:00
Andrew Tridgell 0b6659b36a AP_Baro: support ChibiOS FMUv4 2018-01-15 11:46:02 +11:00
Andrew Tridgell c8c563f90d AP_Baro: support ChibiOS 2018-01-15 11:46:02 +11:00
Pierre Kancir 14b5c8a6c4 AP_Baro: don't include vehicle specific baro by default 2017-12-27 15:13:30 +00:00
Andrew Tridgell 68f8817e97 AP_Baro: removed create() method for objects
See discussion here:

  https://github.com/ArduPilot/ardupilot/issues/7331

we were getting some uninitialised variables. While it only showed up in
AP_SbusOut, it means we can't be sure it won't happen on other objects,
so safest to remove the approach

Thanks to assistance from Lucas, Peter and Francisco
2017-12-14 08:12:28 +11:00
Lucas De Marchi 69b6d95cb2 global: use static method to construct AP_Board_Config{,_CAN} 2017-09-26 03:01:21 +01:00
Lucas De Marchi 91feec0e14 global: use static method to construct AP_Baro 2017-09-26 03:01:21 +01:00
Lucas De Marchi c5c1d5abfe AP_Baro: add static create method 2017-09-26 03:01:21 +01:00
liorosh f2b7dc74d7 AP_Baro: Adding a new LPS25H Barometer driver
The following is a Barometer sensor driver for the LPS25H Barometer that
is integrated in the 96Boards STM32 Sensor mezzanine board.
the update includes the .cpp and .h files of the driver as well as the
updates required in AP_Baro.cpp.
2017-09-16 21:08:06 +10:00
Jacob Walser e492c733d8 AP_Baro: fixup Keller LD comments 2017-08-29 12:30:32 -04:00
Jacob Walser 07e00de549 AP_Baro: Tweak Keller LD driver for better performance after initial tests 2017-08-29 08:08:16 -04:00
Jacob Walser 2a71afd3ba AP_Baro: Remove superfluous casts 2017-08-29 08:08:16 -04:00
Jacob Walser a08da4ecc4 AP_Baro: New AP_Baro_Keller device driver 2017-08-29 08:08:16 -04:00
Lucas De Marchi 7c6f9a004e AP_Baro: use FALLTHROUGH define
When falling through on a case switch, allow to add an empty statement
with the correct attribute to tell the compiler this behavior is
intended.
2017-08-22 23:59:13 -07:00
khancyr 2d0bce18a8 AP_Baro: rename all local variable with prefix
fix last missing spaces
2017-07-24 10:15:15 -07:00
khancyr 35ac86ff8d AP_Baro: fix some style and const correctness 2017-07-24 10:15:15 -07:00
khancyr 0e895f5c74 AP_Baro: fix instance shadowing 2017-07-24 10:15:15 -07:00
Kevin Lopez Alvarez 18dab4829a AP_Baro: initial FMUv4pro support 2017-07-24 13:45:37 +10:00
Michael du Breuil 6b60c110a5 AP_Baro: Improve GND_TEMP parameter docs 2017-07-16 20:22:00 +01:00
Michael du Breuil f14667225d AP_Baro: Avoid a FPE when ground pressure is negative 2017-07-15 10:49:16 +09:00
Peter Barker 1748e7cb0c AP_Baro: make backends responsible for setting their health
This resolves a problem in SITL where the barometer would
not change value for prolonged period of time, making it
go unhealthy
2017-07-14 07:28:48 +09:00
Randy Mackay 6982e58cf2 Baro: health check that values are changing 2017-07-08 08:40:19 +09:00
Eugene Shamaev 6e6efa7e1b AP_Baro: enumeration and multiple interfaces support 2017-07-03 11:44:32 +01:00
Miguel Arroyo 6cf9b870b5 AP_Baro: AP_Baro_SITL more accurately simulates real sensor backend. 2017-06-23 09:36:28 +10:00
Dr.-Ing. Amilcar Do Carmo Lucas ed916327fc AP_Baro: Use SI units conventions in parameter units
Follow the rules from:
http://physics.nist.gov/cuu/Units/units.html
http://physics.nist.gov/cuu/Units/outside.html
and
http://physics.nist.gov/cuu/Units/checklist.html
one further constrain is that only printable (7bit) ASCII characters are allowed
2017-05-17 18:07:25 +10:00
Peter Barker ccc495e4c1 AP_Baro: use HAL_SEMAPHORE_BLOCK_FOREVER macro 2017-05-08 10:23:03 +09:00
Andrew Tridgell 375c7b0f5f AP_Baro: rename macros to avoid conflicts
these macros were also defined in NuttX in clock.h
2017-05-06 15:21:14 +10:00
Andrew Tridgell 9bdf971336 AP_Baro: added set_pressure_correction()
for use by AP_TempCalibration
2017-05-03 20:12:04 +10:00
Andrew Tridgell 99883ffc49 AP_Baro: added temperature sensitivity modelling in SITL 2017-05-03 20:12:04 +10:00
Andrew Tridgell ee4161fa62 AP_Baro: moved SITL baro to standard sensor backend model 2017-05-03 20:12:04 +10:00
Andrew Tridgell cbea29ad71 AP_Baro: use sensor_config_error() 2017-05-03 11:37:01 +10:00
Jacob Walser 96f503d9d1 AP_Baro: Fix GND_EXT_BUS @Values formatting 2017-04-21 21:11:40 +01:00
Eugene Shamaev fd866d3e20 AP_Baro: removal of legacy UAVCAN support 2017-04-17 17:27:18 +10:00
Eugene Shamaev 331419a51e AP_Baro: support for UAVCAN connected barometers 2017-04-10 22:38:12 +01:00
Michael du Breuil c37209a8d5 AP_Baro: Limit ground temperature used for the altitude
Fix an incorrect EAS2TAS that was double counting altitude
2017-03-28 11:25:46 +11:00
Tom Pittenger fb24a03faf AP_Baro: don't compile drivers for devices that don't use them 2017-03-24 12:06:19 +11:00
Lucas De Marchi 00c2949dfb Add support for baro on aerofc 2017-03-24 12:06:19 +11:00
Francisco Ferreira f6687a2d6c AP_Baro: fix example output
PX4 boards can only start console after USB is connected so we need to
check it is available
2017-03-07 09:37:14 +11:00
Andrew Tridgell d5cad2ae44 AP_Baro: support AUAV21 board 2017-03-01 17:24:10 +11:00
Tom Pittenger fb214ef95f AP_Baro: fixed spelling in comment 2017-02-21 02:23:23 -08:00
Jacob Walser 613bc46592 AP_Baro: Add support for water pressure and Sub 2017-02-21 11:26:14 +11:00
murata f5c3de2a61 AP_Baro: Change from magic number 0 to definition name. 2017-02-18 14:12:36 +00:00
Lucas De Marchi 9814dc81e2 AP_Baro: examples: better output formatting 2017-02-12 01:22:35 +00:00
Lucas De Marchi 402f0cce85 AP_Baro: examples: fix coding style 2017-02-12 01:22:35 +00:00
murata 32b60432b4 AP_Baro: Add format specification.
AP_Baro: Add format specification.
2017-01-27 18:20:22 +11:00
murata 78a4cab06b AP_Baro: Unify from print or println to printf. 2017-01-27 18:20:22 +11:00
Andrew Tridgell 8aa100d164 AP_Baro: fix for change to timer API 2017-01-14 12:54:37 +11:00
mirkix 1ce5e5360a AP_Baro: Add Bosch BMP280 driver 2017-01-14 12:52:07 +11:00
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
murata 87c2dfd921 AP_Baro: Change to secure code, from magic number to sizeof value. 2017-01-12 13:56:18 -08:00
Victor Lambret a4108251e3 AP_Baro: fix get_last_update(instance)
The method was not using the instance parameter. Instead it always use
primary barometer. Bug was not detected because method
get_last_update() is used where instance is _primary.

Detected with warnings, warnings are useful :-)
2017-01-04 17:32:24 +00:00
murata 753638851e AP_Baro: Changed if statements to switch statement. 2016-12-20 14:13:47 +00:00
Andrew Tridgell 8a1275356d AP_Baro: moved MS5611 reset before prom read
thanks to Jacob and Lucas for pointing this out
2016-12-13 11:10:35 +11:00
Andrew Tridgell eea7758a63 AP_Baro: added GND_EXT_BUS option
this is needed to enable probing for a MS5611 on external I2C bus. The
MS5611 looks the same as a MS5525 airspeed sensor, so we can't just
auto-probe. Users will need to enable external barometers
2016-12-05 16:51:49 -08:00
Andrew Tridgell cd57422eed AP_Baro: set retries high during init of MS5611 on I2C 2016-12-02 09:47:51 +11:00
Andrew Tridgell f2246326bb AP_Baro: added MS5611 probing, and support 3 baros on Pixhawk2
this adds sensor probing for barometers, simplifies the MS5611 driver,
and adds support for the I2C external barometers on Pixhawk2
2016-11-25 21:40:11 +11:00
Andrew Tridgell c2125a0078 AP_Baro: wait forever for semaphore on startup 2016-11-21 18:04:10 -02:00
Andrew Tridgell b16226dddf AP_Baro: fixed a bug with corrupted conversions in MS5611 driver
the datasheet says that if you get back zero in an ADC read that the
next value can be corrupt. I have seen this happen on the FMUv1,
leading to bad altitude readings
2016-11-13 17:08:06 +11:00
Andrew Tridgell 41b132e576 AP_Baro: setup for new board PX4 IDs 2016-11-11 08:08:55 +11:00
Andrew Tridgell d716bbedee AP_Baro: use in-tree drivers for PH2SLIM 2016-11-10 11:44:52 +11:00
Andrew Tridgell fea7040aff AP_Baro: don't panic when we can't find MS5611
this makes booting a PH2 without its sensor hat on much easier
2016-11-10 11:44:51 +11:00
Andrew Tridgell b8c789cf35 AP_Baro: switch pixracer to always use in-tree drivers 2016-11-09 17:08:14 +11:00
Andrew Tridgell 565f1986e0 AP_Baro: fixed FMUv1 baro and enable in-tree driver for PHMINI 2016-11-09 17:08:13 +11:00
Andrew Tridgell 66026100c3 AP_Baro: enable dual baro on PH2 2016-11-09 17:08:03 +11:00
Andrew Tridgell 4df9b093c3 AP_Baro: fixed missed samples in ms5611 driver 2016-11-09 17:08:03 +11:00
Andrew Tridgell bedee31f61 AP_Baro: fixed semaphore and thread usage in baro drivers 2016-11-09 17:08:02 +11:00
Andrew Tridgell 72c2e3a4d5 AP_Baro: select in-tree vs PX4 drivers at runtime 2016-11-09 17:07:58 +11:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
Peter Barker dbecb1bc25 AP_Baro: add missing parameter metadata 2016-10-27 09:15:03 -07: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 ae53920e5b build: don't build examples with old build system
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file.  Having the makefiles
there is misleading since people try to build and realize the build is
broken.
2016-10-11 13:03:08 +11:00
Andy Little 0d113b265c Examples: fix examples for px4
The change to use AP_BoardConfig messed up the examples. Here are some
updated but there are plenty more to do.
2016-10-04 12:50:47 -03:00
Lucas De Marchi e217faacab AP_Baro: MS56XX: cosmetic changes to members
- reorder and document members.
    - remove tentative of vertical alignement
    - like was done for accumulated values, move the calibration
      values to a struct
2016-07-30 00:55:28 -03:00
Lucas De Marchi f7b453359d AP_Baro: MS56XX: convert to threaded bus
This converts MS56XX to use the thread started by SPI/I2C instead of
using the timer thread. This also fixes a possible starvation of the
main thread:

    1) INS driver registers itself to be sampled on timer thread
    2) MS56XX registers itself to be sampled on timer thread
    3) Main thread waits for a sample from INS with
       ins.wait_for_sample()
    4) timer thread is waiting on update from MS56XX and consequently
       the main thread is waiting on an I2C/SPI transfer

Besides this starvation there's another one due to reuse of the timer
lock in order to pump values from the timer thread to the main thread. A
call to the update() method when we have a sample available would need
to wait on any other driver holding the timer lock.

Now there's a lock just to pass the new values from the bus thread to
the main thread with a very tiny critical region, not waiting on any
bus transfers and/or syscalls.
2016-07-30 00:55:28 -03:00
Lucas De Marchi 929348ff75 AP_Baro: MS5611: always use timer thread
Remove support to run MS5611 on main thread since we shouldn't be doing
I2C transactions there and we are moving to "thread per bus"
nonetheless.
2016-07-30 00:55:28 -03:00
Tom Pittenger 84ce499a0d AP_Baro: remove zero-init in constructor 2016-07-11 22:11:34 -07:00
Tom Pittenger 1d81df8144 Revert "AP_Baro: coverity scan - variables not initialized in constructor"
This reverts commit 8d2872d3ab.
2016-07-11 22:02:41 -07:00
Tom Pittenger 8d2872d3ab AP_Baro: coverity scan - variables not initialized in constructor 2016-07-05 13:32:06 -07:00
Tom Pittenger f1f58e2026 AP_Baro: created baro drift offset accessor 2016-05-13 17:22:11 -07:00
Tom Pittenger d55050e5e3 AP_Baro: slow down the LPF for slewing to a new GND_ALT_OFFSET
Instead of a couple seconds, make it about 15sec. This makes TECS happy by not glitching the height demand as much. When applied too fast the TECS height demand causes a large single oscillation as it chases the filter lag.
2016-05-13 17:15:53 -07:00
Tom Pittenger 37ee3b44d2 AP_Baro: add accessor for baro drift 2016-05-13 17:15:41 -07: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 56fa1b6214 AP_Baro: BMP085: change oversampling in BMP085 without EOC
If we don't have EOC pin and assuming the accumulate() function is
called at 50Hz (or higher) we would take very few samples to accumulate
before the update is called. That's because since we have to wait 26ms
to get a sample and we calling accumulate() every 20ms, half of the
times it will return without getting anything.  So we will
be using 2 or 3 samples only to average.

If we don't have EOC, use OVERSAMPLING=2 which gives us more noise, but
that we can filter out by using measurements to average. When we have
EOC we don't need it because most of the time the conversion will take
less than 20ms: I'm getting 16ms on most of them while bench-testing.
2016-05-10 14:24:58 -03:00
Lucas De Marchi 37e2f6c52e AP_Baro: BMP085: allow to easily change oversampling in BMP085
This way it's possible to easily change it if a board requires.
2016-05-10 14:24:58 -03:00
Andrew Tridgell 8b7bf5cf7a AP_Baro: allow setHIL to set last update time 2016-05-07 18:27:21 +10:00
Andrew Tridgell 0b71652afc AP_Baro; allow for exact replay of baro data 2016-05-07 18:27:20 +10:00
Andrew Tridgell 8a987bf67d AP_Baro: removed filtering of baro data in HIL/SITL
this was just causing lag in replay and doesn't actually help in SITL
2016-05-07 18:27:18 +10:00
Don Gagne cae7ea0d13 Add @Volatile, @ReadOnly support 2016-03-17 10:58:05 +11:00
Andrew Tridgell 0a72c2bbd5 AP_Baro: prevent bad ground pressure from making a board unbootable 2016-02-23 16:34:06 +11:00
Lucas De Marchi f1ade970a3 AP_Baro: MS5611: Use AP_HAL::Device abstraction
This allows to share almost all the I2C/SPI code and remove the
AP_Serial abstraction since that is now handled by AP_HAL itself.
2016-02-16 19:49:09 -02:00
Lucas De Marchi b05954660a AP_Baro: BMP085: use I2CDevice interface 2016-02-16 19:49:09 -02:00
Tom Pittenger f435c5ee50 AP_Baro: tolerate GND_ALT_OFFSET step inputs
large inputs make the EKF angry, this will allow the param update to slew over a few seconds
2016-02-08 21:13:58 -08:00
Lucas De Marchi 56e4de0bdd AP_Baro: MS56XX: remove initialization to 0 from constructor 2016-02-01 14:18:50 -02:00
Lucas De Marchi 9d5fb97819 Global: rename enum SPIDevice to SPIDeviceType
Free the SPIDevice name so to have a consistent name for I2C/SPI device
classes.
2016-02-01 14:18:50 -02:00
Gustavo Jose de Sousa c2e3f05dbf waf: ardupilotwaf: prefix build context methods with ap_
It helps to distinguish between things from waf and things from ardupilotwaf.
2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa 3d22490397 waf: examples: use methods from bld instead of ardupilotwaf 2016-01-22 20:10:29 -02:00
Julien BERAUD d15097f3fc AP_Baro_MS5611: Support for timesliced timers
fallback if current scheduler doesn't support it
2016-01-18 16:57:48 -02:00
Gustavo Jose de Sousa d281067bcc waf: make example binaries be placed in 'examples' dir
This commit makes examples' wscripts use ardupilotwaf.example() instead of
ardupilot.program().
2016-01-15 16:46:41 -02:00
Jonathan Challinger dcfc95fadf AP_Baro: fix example build 2015-12-29 10:46:35 -08:00
Lucas De Marchi a096703b06 Global: don't link with AP_Progmem
AP_Progmem is not used anymore.
2015-12-27 15:58:12 -02:00
Andrew Tridgell ff44a63007 AP_Baro: added QURT driver 2015-12-27 16:21:25 +11:00
Andrew Tridgell 1f4e503d91 AP_Baro: added qflight driver 2015-12-27 16:12:27 +11:00
Andrew Tridgell ef83f39029 AP_Baro: renamed _C* vars to avoid conflict with qurt 2015-12-20 17:55:39 +11:00
Lucas De Marchi 5b1769cd2b AP_Baro: remove unused AP_ADC_AnalogSource 2015-12-03 13:32:42 +11:00
Caio Marcelo de Oliveira Filho 6e7b73610d waf: add waf support 2015-12-03 07:54:30 +11: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
Lucas De Marchi 30f631de8f AP_Baro: MS5637: fix CRC check
The configuration of MS5637 is different from MS5611 in 2 ways:

    - The PROM is of 112 bytes rather than 128
    - The CRC is located in the first MSB of the first word, not the
      last one

For CRC calculation we also need to zero out the last (missing) word.

This renames _check_crc() to _read_prom(), which returns false when the
PROM doesn't contain valid data. It also makes it virtual so MS5637 can
override it. This also moves the PROM read to be all in the same place
rather than split between the CRC field and coefficient fields. Finally
calculate_crc() is renamed to crc4() to be shorter and add info on what
it does.
2015-12-02 10:38:09 +11:00
José Roberto de Souza 7457588d7c AP_Baro: Move initialisation code from MS56XX constructor to init()
On MS5637 we will need to override the method to read and calculate the
PROM's crc. Thus we need a 2-phase init.

It also makes the constructor of AP_Baro_MS56XX protected since only the
derived classes should instantiate the base one.
2015-12-02 10:38:09 +11:00
José Roberto de Souza 29791c9cec AP_Baro: Make _check_crc more readable 2015-12-02 10:38:09 +11:00
Caio Marcelo de Oliveira Filho 8cce3067f4 AP_Baro: examples use millis/micros/panic functions 2015-11-20 12:29:38 +09:00
Caio Marcelo de Oliveira Filho 5a280838f8 AP_Baro: use millis/micros/panic functions 2015-11-20 12:29:31 +09:00
Lucas De Marchi 977f6aaf15 AP_Baro: MS5611: remove empty statement 2015-11-11 13:48:48 +11:00
Lucas De Marchi 94d01934f7 AP_Baro: MS5611: reduce OSR to 1024
This is the same change as done in PX4:

	This reduces self-heating of the sensor which reduces the amount
	of altitude change when warming up. Apparently some individual
	sensors are severely affected by this.

	Unfortunately it raises the noise level, but Paul is confident
	it won't be a significant issue.
2015-11-11 13:48:48 +11:00
Andrew Tridgell 840c9e65bb AP_Baro: don't notify the GCS of new pressure reference too often 2015-11-09 14:34:07 +11:00
Peter Barker 1b13315092 AP_Baro: notify GCS of calibration 2015-11-09 09:23:20 +11:00