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
Lucas De Marchi
8eef58a8c2
AP_Baro: remove check for AVR CPUs
...
Remove the checks for HAL_CPU_CLASS > HAL_CPU_CLASS_16 and
HAL_CPU_CLASS >= HAL_CPU_CLASS_75. Corresponding dead code will be
removed on separate commits.
2015-11-04 12:14:14 +11:00
Lucas De Marchi
4bd8b2ae35
AP_Baro: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1
2015-11-04 12:14:11 +11:00
Lucas De Marchi
831d8acca5
Remove use of PROGMEM
...
Now variables don't have to be declared with PROGMEM anymore, so remove
them. This was automated with:
git grep -l -z PROGMEM | xargs -0 sed -i 's/ PROGMEM / /g'
git grep -l -z PROGMEM | xargs -0 sed -i 's/PROGMEM//g'
The 2 commands were done so we don't leave behind spurious spaces.
AVR-specific places were not changed.
2015-10-30 14:35:16 +09:00
Lucas De Marchi
2c38e31c93
Remove use of PSTR
...
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.
This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.
AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Lucas De Marchi
386547427d
AP_Baro: support MS5611 on second i2c bus
2015-10-22 12:04:52 +11:00
wsilva32
da9118fbd0
AP_Baro: average SITL baro measurements using update()
2015-10-21 10:25:08 +11:00
Lucas De Marchi
4d3229daa2
AP_Baro: remove check for HAL_CPU_CLASS
...
We don't support HAL_CPU_CLASS <= HAL_CPU_CLASS_16 anymore. This makes
BARO_MAX_INSTANCES and BARO_MAX_DRIVERS constant for all supported
boards.
2015-10-21 10:05:18 +11:00
Caio Marcelo de Oliveira Filho
24178c3e10
AP_Baro: remove unnecessary includes in example
2015-10-21 09:16:10 +11:00
Caio Marcelo de Oliveira Filho
ec52df991c
build: compile only the HAL files needed by the board
...
Instead of requiring every program to specify the HAL related modules,
let the build system do it (in practice everything we compiled depended
on HAL anyway). This allow including only the necessary files in the
compilation.
2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho
2e464a53c2
AP_HAL: make code not depend on concrete HAL implementations
...
The switching between different AP_HAL was happening by giving different
definitions of AP_HAL_BOARD_DRIVER, and the programs would use it to
instantiate.
A program or library code would have to explicitly include (and depend)
on the concrete implementation of the HAL, even when using it only via
interface.
The proposed change move this dependency to be link time. There is a
AP_HAL::get_HAL() function that is used by the client code. Each
implementation of HAL provides its own definition of this function,
returning the appropriate concrete instance.
Since this replaces the job of AP_HAL_BOARD_DRIVER, the definition was
removed.
The static variables for PX4 and VRBRAIN were named differently to avoid
shadowing the extern symbol 'hal'.
2015-10-21 09:16:07 +11:00
José Roberto de Souza
c53e9d1ff0
AP_Baro: Fix typo
2015-10-16 10:05:03 +11:00
José Roberto de Souza
9a98eb35fc
AP_Baro: Add MS5637 over I2C to init()
2015-10-16 10:05:03 +11:00
José Roberto de Souza
c373ce34d1
AP_Baro: MS56XX: Some minor fixes
2015-10-16 10:05:03 +11:00
José Roberto de Souza
d9931b5f34
AP_Baro: Add support to MS5637
...
As AVR2560 is not supported anymore and do integer operations is
usually faster than float-point the _calculate() implementation was
done using only integer operations and as more close to what
datasheet says.
2015-10-16 10:05:03 +11:00
raspilot
831bb554e7
AP_Baro_MS5611: suspend timer when init to prevent other SPI drivers grabbing the bus.
2015-10-02 09:54:55 +10:00
mirkix
ba4db34c83
AP_Baro: Prevent busy waiting
2015-10-02 09:49:12 +10:00
Julien BERAUD
3b5d73b1fe
AP_Baro_MS5611: Fix state machine in case of error
...
If there is a read error, reading from the adc will return 0 but moreover,
we need to re-initiate a read or else we are stuck forever.
From MS5611-01BA03 datasheet, p. 10, CONVERSION SEQUENCE:
"After the conversion, using ADC read command the result is clocked out with the MSB first.
If the conversion is not executed before the ADC read command, or the ADC read command is
repeated, it will give 0 as the output result."
2015-09-23 09:19:22 +10:00
Andrew Tridgell
a5462fec0b
AP_Baro: allow selection of primary barometer and add 3rd baro
...
this is useful for external I2C barometers on a PH2
2015-09-14 14:27:41 +10:00
Gustavo Jose de Sousa
bcd5dff774
AP_Baro: MS56XX: do not change change state on error
...
If we have an error in the SPI or I2C transaction we should not change
the state. Otherwise we might read a temperature when the sensor is
reporting pressure and vice-versa.
2015-09-01 20:26:06 +10:00
Gustavo Jose de Sousa
1f29e18375
AP_Baro: make AP_SerialBus::write() return success or failure for MS56XX
2015-09-01 20:26:05 +10:00
Tom Pittenger
749c0c190f
AP_Baro - fix BARO_ALT_OFFSET param
...
This param seems to have been un-implemented. This is putting it back in. Adds a meter offset to the calculated altitude form the baro sensors.
Also changes it from int8 to float
2015-08-26 13:16:05 +10:00
Gustavo Jose de Sousa
f18802bc46
AP_Baro: standardize inclusion of libaries headers
...
This commit changes the way libraries headers are included in source files:
- If the header is in the same directory the source belongs to, so the
notation '#include ""' is used with the path relative to the directory
containing the source.
- If the header is outside the directory containing the source, then we use
the notation '#include <>' with the path relative to libraries folder.
Some of the advantages of such approach:
- Only one search path for libraries headers.
- OSs like Windows may have a better lookup time.
2015-08-11 16:28:42 +10:00
Grant Morphett
312184dd13
AP_Baro: coverity fixes - add param init in constructor
2015-07-30 12:37:08 +10:00
Randy Mackay
5732a6a144
Baro: update climb rate only if healthy
2015-07-29 16:32:49 +09:00
Julien BERAUD
d407737434
AP_Baro: added MS5607 support
2015-07-10 16:46:29 +10:00
Andrew Tridgell
282efe2d57
AP_Baro: fixed example to run accumulate at 50Hz
2015-07-10 09:59:35 +10:00
Andrew Tridgell
4368f922a3
AP_Baro: convert example from .pde to .cpp
2015-06-01 16:58:10 +10:00
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
ziltoid2
23787cf695
AP_Baro: use ground_temperature instead of calibration_temperature for alt calculation
2015-05-20 11:42:21 +10:00
Andrew Tridgell
48fb7f8159
AP_BARO: revert AP_Math class change
2015-05-05 13:27:05 +10:00
Tom Pittenger
0b29848277
AP_Baro: compiler warnings: apply is_zero(float) or is_equal(float)
2015-05-05 13:26:56 +10:00
Andrew Tridgell
7d9d594283
AP_Baro: fix for HAL_SITL rename
2015-05-05 09:45:55 +10:00
Randy Mackay
55298a4c73
Baro: fix example sketch
2015-05-02 17:25:44 +09:00
Randy Mackay
1b381b5675
Baro: get_air_density_ratio gets div-by-zero check
2015-04-29 14:36:20 +09:00
Jonathan Challinger
f381ef93e8
AP_Baro: add get_air_density_ratio
2015-04-29 14:36:10 +09:00
Tom Pittenger
4191c44bbd
Baro: fix compile warning re member init order
2015-04-24 14:15:11 +09:00
Andrew Tridgell
2e9d2e6449
AP_Baro: load only HIL backend for hil_mode
2015-03-13 22:52:55 +11:00
Andrew Tridgell
d040318014
AP_Baro: removed unused define
2015-03-13 18:46:17 +11:00
Randy Mackay
4e7d92094c
Baro: remove glitch detection
2015-03-13 16:40:29 +09:00
Andrew Tridgell
1f70b34cbc
AP_Baro: fixed baro startup on PXF cape
2015-03-13 13:48:41 +11:00
Andrew Tridgell
beeb9173ea
AP_Baro: change for new PX4 paths
2015-02-14 12:25:43 +11:00
Andrew Tridgell
ac3dd87790
AP_Baro: added hil_mode support
2015-02-10 09:53:30 +11:00
Randy Mackay
bb4204c045
Baro: fix example sketch
2015-01-28 17:15:37 +09:00
Randy Mackay
c93e7a69a7
Baro: init external_temperature in constructor
2015-01-12 13:56:35 +09:00
Andrew Tridgell
b1d8df3d54
AP_Baro: only allow calibrated sensors to be used
2015-01-09 12:59:01 +11:00
Andrew Tridgell
3320dfd7fa
AP_Baro: fixed ms5611 spelling error
2015-01-09 11:59:49 +11:00
Andrew Tridgell
0a8677b3e2
AP_Baro: fixed build after rebase with all_healthy()
2015-01-09 11:51:52 +11:00
Andrew Tridgell
1c2a6deaaf
AP_Baro: added all_healthy() method
2015-01-09 11:51:51 +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
197c09fcd8
AP_Baro: added num_instances() API
2015-01-09 11:50:56 +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
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
Randy Mackay
ddda0d52ce
Baro: reorder declaration to fix compiler warning
...
No functional change
2014-12-11 13:06:24 +09:00
Andrew Tridgell
e45522f51d
AP_Baro: fixed example build
2014-11-28 10:40:43 +11:00
Andrew Tridgell
d404cc6542
AP_Baro: add set_external_temperature()
...
this allows the use of an external temperature sensor for calibration
purposes, such as the sensor built in to the digital airspeed sensor.
The main affect this has is on the EAS2TAS calculation
The get_calibration_temperature() is used to choose either an external
temperature or an internal one. If an internal one is used then it is
clamped at no higher than 25 degrees C, to prevent hot electronics
on startup affecting altitude scaling and EAS2TAS
2014-11-12 13:36:01 +11:00
Andrew Tridgell
8b794602d1
AP_Baro: make get_temperature() a const function
2014-11-12 13:36:01 +11:00
Randy Mackay
67690553c5
BaroGlitch: add reset method
2014-11-09 13:34:15 -08:00
Randy Mackay
3a81732721
Baro: minor param description updates
2014-10-14 12:42:27 +09:00
Andrew Tridgell
5280d8936d
AP_Baro: remove usage of hrt_absolute_time()
...
use a single time base in all code
2014-08-20 08:41:15 +10: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
fd5dee96e4
BaroGlitch: check baro health after alt calculation
...
Also correct type of distance_cm internal variable
2014-08-14 16:03:33 +09:00
Randy Mackay
424a65663a
Baro: init members to resolve compiler warning
2014-08-14 16:03:30 +09:00
Randy Mackay
53b073148b
BaroGlitch: use baro healthy()
2014-08-14 16:03:21 +09:00
Randy Mackay
78b1bf8282
Baro: example sketch to use healthy() function
2014-08-14 16:03:15 +09:00
Randy Mackay
76634ee8c3
Baro_PX4: use healthy flag
2014-08-14 16:03:12 +09:00
Randy Mackay
d29fe51cb3
Baro_VRBrain: use healthy flag
2014-08-14 16:03:09 +09:00
Randy Mackay
24db492131
Baro_MS5611: use healthy flag
2014-08-14 16:03:06 +09:00
Randy Mackay
72f6985bd8
Baro_HIL: use healthy flag
2014-08-14 16:03:04 +09:00
Randy Mackay
fdb38dec5f
Baro_BMP085: use healthy flag
2014-08-14 16:03:02 +09:00
Randy Mackay
330d883f97
Baro: add altitude sanity check
...
healthy flag made protected
healthy accessor fn added which also check latest calculated altitude
was ok
2014-08-14 16:02:59 +09:00
Randy Mackay
e9fbea9497
Baro: make get_altitude_difference const
2014-08-14 16:02:55 +09:00
Randy Mackay
af28b74944
Baro_BMP085: init members to resolve compiler warnings
2014-08-14 11:27:29 +09:00
Andrew Tridgell
a400cbc922
AP_Baro: fixed example build
2014-08-13 21:46:14 +10:00
Mikhail Avkhimenia
83bbee491c
AP_Baro_MS5611: add address switch for Navio board
2014-08-12 22:09:29 +10:00
Randy Mackay
5d4e019397
BaroGlitch: increase max accel to 15m/s/s
2014-08-09 15:47:52 +09:00
Andrew Tridgell
6ebff35fe2
AP_Baro: don't include I2C MS5611 on APM1 either
2014-08-03 17:17:20 +10:00
Randy Mackay
fe24721218
BaroGlitch: increase default ok distance to 5m
...
When taking off some copters hove a sudden baro altitude dip of 4m
2014-08-02 11:43:06 +09:00
Randy Mackay
c68d4fdfcb
BaroGlitch: init members to resolve compiler warning
2014-08-01 14:07:34 +09:00
Randy Mackay
728da12441
BaroGlitch: remove debug
2014-07-29 22:05:09 +09:00
Andrew Tridgell
c538cc0665
AP_Baro: fixed example build
2014-07-29 21:04:26 +10:00
Randy Mackay
2289b98d34
Baro_Glitch: initial version of baro glitch protection
...
Based on GPS Glitch protection library
2014-07-28 22:16:12 +09:00
Andrew Tridgell
a458f1bf5f
AP_Baro: minor improvements to Baro HIL code health check
2014-07-24 21:46:06 +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
b0ab2671cd
AP_Baro: removed old device specific example code
...
not needed any more
2014-07-14 09:44:36 +10:00
Andrew Tridgell
028e2e34f1
AP_Baro: added generic baro test sketch
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
Víctor Mayoral Vilches
8a85f8d6d2
AP_Baro_MS5611_test: Add HAL specific code.
2014-07-14 09:29:53 +10:00
Víctor Mayoral Vilches
de58df6371
AP_Baro_MS5611_test: Add block for APM2-code
2014-07-14 09:29:45 +10:00
Víctor Mayoral Vilches
9797867067
AP_Baro_MS5611: Fix the test code so that compiles.
...
Add HAL_BOARD_LINUX and HAL_BOARD_ERLE compatibility.
2014-07-14 09:02:47 +10:00
Andrew Tridgell
74c3b404ee
AP_Baro: avoid some float conversion warnings
2014-07-08 20:26:54 +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
3705c90b8e
AP_Baro: fix for HAL_GPIO_*
2014-06-02 10:42:36 +10:00
Andrew Tridgell
41dd280739
AP_Baro: expose get_altitude_difference()
...
this is useful for pressure altitude calculations
2014-04-11 16:34:02 +10:00
Emile Castelnuovo
f4784fe6a1
AP_Baro: new files for VRBRAIN board
2014-04-08 16:19:19 +10:00
Andrew Tridgell
d3d71d597c
AP_Baro: fixed example build
2014-03-19 12:14:05 +09:00
Andrew Tridgell
63234d4c22
AP_Baro: fixed linux build of BMP085 driver
2014-03-07 09:33:43 +11:00
Andrew Tridgell
b2bd81f262
AP_Baro: added alternative setHIL interface
...
uses pressure and temperature for better log replay
2014-02-18 09:25:07 +11:00
Andrew Tridgell
3af38a778d
AP_Baro: fixed example build
2014-02-15 06:40:15 +11:00
Randy Mackay
bb715424ee
Baro: fix BMP085 example sketch
2014-02-15 06:09:08 +11:00
Andrew Tridgell
6964529124
AP_Baro: _calculate can be private
2014-02-15 05:48:24 +11:00
Andrew Tridgell
2cd781997f
AP_Baro: changed HIL driver to use floats and better handle starup
2014-02-15 05:48:18 +11:00
Andrew Tridgell
5e3c4441dc
AP_Baro: use HAL_CPU_CLASS in baro driver
2013-12-31 10:28:37 +11:00
Andrew Tridgell
42eba615b4
AP_Baro: fixed example build
2013-12-17 11:51:37 +11:00
Andrew Tridgell
6c2e392d5d
AP_Baro: fixed BMP085 examples build in autotest
2013-11-23 18:50:55 +11:00
Andrew Tridgell
8a65a729f3
AP_Baro: start MS5611 at high speed
2013-11-07 12:48:17 +11:00
Tobias
7855d242c7
AP_Baro: add time-unit comment
2013-10-27 13:39:23 +09:00
Andrew Tridgell
3393a5c99e
AP_Baro: prevent a race condition in the SITL baro driver
2013-10-17 17:22:19 +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
6fa55d101f
AP_Baro: fixed I2C semaphore handling for BMP085 driver
2013-10-08 11:50:54 +11:00
Andrew Tridgell
487caea3a5
AP_Baro: added update_calibration() method
...
used for auto baro calibration when disarmed
2013-10-05 18:44:00 +10:00
Andrew Tridgell
c04d9b0c03
AP_Baro: updates for AP_HAL::MemberProc
2013-09-30 21:06:42 +10:00
Andrew Tridgell
8a699f6189
AP_Baro: enable BMP085 on Linux
2013-09-28 22:04:15 +10:00
Andrew Tridgell
20b1131059
AP_Baro: use new scheduler API
2013-09-28 21:24:03 +10: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
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
Andrew Tridgell
517c44bbaa
AP_Baro: fixed example build
2013-08-30 13:01:36 +10:00
Andrew Tridgell
395739dded
AP_Baro: simplify PX4 driver
...
we can now rely on queueing in NuttX driver
2013-08-30 13:01:34 +10:00
Andrew Tridgell
5607c89df0
AP_Baro: use fabs() not abs()
...
thanks to Randy for spotting this
2013-08-30 13:01:33 +10:00
Paul Riseborough
ba009e55e3
AP_Baro : Fixed bug in temperature units in AP_Baro_HIL
2013-07-22 12:50:02 +10:00
Andrew Tridgell
ebebee4f06
AP_Baro: extend the atmospheric model to higher altitudes
2013-07-22 12:50:02 +10:00
Andrew Tridgell
0c6725f289
AP_Baro: improved the accuracy of the barometer model
2013-07-22 12:50:01 +10:00
Andrew Tridgell
0f72401d8d
AP_Baro: added GND_ALT_OFFSET parameter
...
used for automatic barometric adjustment by a ground station equipped
with a barometer
2013-07-10 14:38:57 +10:00
Paul Riseborough
7bdb098e77
AP_Baro: added get_EAS2TAS()
...
this provides the scaling factor between equivalent and true airspeed
based on altitude
2013-07-04 16:56:56 +10:00
Andrew Tridgell
61361dac9b
AP_Baro: added units to baro documentation
2013-07-04 16:56:56 +10:00
Paul Riseborough
3b98bbd159
AP_Baro: more precise altitude calculation on PX4
...
if not using an AVR CPU then use a more computationally expensive
altitude calculation, which is more precise at higher altitudes
2013-07-04 16:56:56 +10:00
Randy Mackay
aa2b10f044
AP_Baro: TEMP parameter comment fix
2013-06-18 11:28:36 +09:00
Andrew Tridgell
ed93f80ba9
AP_Baro: fixed example build
2013-05-08 16:45:07 +10:00
Andrew Tridgell
26bf636541
AP_Baro: fixed a build warning
2013-05-02 21:31:04 +10:00
Andrew Tridgell
7cec3caf19
AP_Baro: cleaned up setHIL method
...
move pressure calculation into library
2013-05-02 15:26:38 +10:00
Andrew Tridgell
c6c1fce2f1
AP_Baro: removed HIL constructor
...
this wasn't calling the parent class
2013-05-02 15:16:52 +10:00
Andrew Tridgell
2d089174cd
AP_Baro: rename AP_Baro_BMP085_HIL to AP_Baro_HIL
...
there is nothing specific to the BMP085 in it
2013-05-02 15:08:42 +10:00
Andrew Tridgell
d7ec985029
AP_Baro_PX4: fixed baro driver to run at full rate
...
we were skipping samples due to a timer handling bug. It now checks
for new samples at 100Hz
2013-05-01 08:54:53 +10:00
Janne Mäntyharju
7a04fe9915
AP_Baro: Fixed build for APM2 Beta hardware
2013-04-16 11:24:38 +10:00
Andrew Tridgell
f0469a21f2
AP_Baro: fixed timestamp on baro for PX4
...
milliseconds not microseconds
2013-01-22 21:22:01 +11:00
Andrew Tridgell
b9b3ef91a1
AP_Baro: added timer to PX4 driver
...
this gives us more samples when main sketch is reading slowly
2013-01-21 18:20:05 +11:00
Andrew Tridgell
6a5421a361
AP_Baro: ask for maximum poll rate for PX4
2013-01-21 08:27:02 +11:00
Andrew Tridgell
74f7b0f218
AP_Baro: added accumulate method to PX4 driver, and fixed scaling
2013-01-20 22:13:21 +11:00
James Bielman
4fa7bb1486
Add AVR compatibility header for missing math.h definitions.
...
- Define float versions of math functions to the double versions
on AVR (eg. #define sinf sin).
- These macros appear to be missing in older versions of avr-libs.
- Include AP_Math.h rather than math.h to get these definitions.
2013-01-16 13:52:17 +11: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
Andrew Tridgell
2fe4656a50
Merge pull request #4 from GaloisInc/master
...
Thanks Pat!
2013-01-10 17:24:59 -08: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
2c603a0960
AP_Baro: only build BMP085 driver on APM1
2013-01-10 21:01:07 +11:00
Andrew Tridgell
8cb0ed364a
AP_Baro: read 4 pressure values for every temperature value on BMP085
2013-01-09 23:44:26 +11:00
Andrew Tridgell
1ce1fa3864
AP_Baro: update example to use accumulate()
2013-01-09 23:06:24 +11: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
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
Andrew Tridgell
c15bf95e19
AP_Baro: fixed example build on AVR
2013-01-04 22:45:02 +11:00
Andrew Tridgell
aa64a41512
AP_Baro: removed debug line
2013-01-04 22:26:51 +11:00
Andrew Tridgell
4fe7ad6267
AP_Baro: added averaging to PX4 baro driver
2013-01-04 21:08:20 +11:00
Andrew Tridgell
dbcaa4cf3c
AP_Baro: average over multiple samples in PX4 baro driver
2013-01-04 20:11:30 +11:00
Andrew Tridgell
2ac6541526
AP_Baro: added PX4 barometer driver
2013-01-04 14:58:24 +11: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
264db3670e
AP_Baro: Add CONFIG_MS5611_SERIAL option to choose between SPI and I2C.
...
- Update ArduCopter and ArduPlane modules to pass the correct serial
driver to the MS5611 driver.
- Update barometer examples, assuming SPI.
2013-01-03 13:48:06 -08:00
James Bielman
5753ae5692
AP_Baro: Add I2C support to MS5611 driver.
2013-01-03 13:48:06 -08:00
Andrew Tridgell
374af1cd14
build: change from Arduino.mk to apm.mk
2013-01-02 17:29:37 +11:00
Andrew Tridgell
c5ba33d39a
AP_Baro: fixed MS5611 semaphore handling
2012-12-21 19:33:57 +11:00
Andrew Tridgell
3aa39da6cd
AP_Baro: removed some debug code
2012-12-20 14:53:23 +11:00
Andrew Tridgell
a1187519a8
AP_HAL: use AP_HAL_BOARD_DRIVER in remaining test sketches
2012-12-20 14:52:37 +11:00
Andrew Tridgell
c15eb97c8d
AP_Baro: fixed example build
2012-12-20 14:52:36 +11:00
Pat Hickey
eb530b86e8
move Arduino.mk to /mk/Arduino.mk
2012-12-20 14:52:35 +11:00
Pat Hickey
107ab1a694
AP_Baro: translated to SPI transactions
2012-12-20 14:52:32 +11:00
Pat Hickey
d92e8045c1
AP_Baro: uses scheduler panic
2012-12-20 14:52:31 +11:00
Pat Hickey
2c2279722b
AP_Baro_MS5611: use scheduler panic
2012-12-20 14:52:31 +11:00
Andrew Tridgell
7d27e420ae
AP_HAL: remove unnecessary Arduino.h includes
2012-12-20 14:52:30 +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
Andrew Tridgell
cafeaf91d6
AP_Baro: updates for new AP_Param API
2012-12-20 14:51:38 +11:00
Pat Hickey
475da4eca4
CONFIG_HAL_BOARD - test sketches fixed up, build all passes
2012-12-20 14:51:37 +11:00
Andrew Tridgell
2ea243e45b
AP_Baro: removed unused code
2012-12-20 14:51:37 +11:00
Pat Hickey
bfd03ab40c
AP_Baro: robust spi device
2012-12-20 14:51:35 +11:00
Pat Hickey
60f7788be4
AP_Baro: robust calibration
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
a4f1f6a5db
AP_Progmem: fix dependencies for all sketches touched by AP_HAL_AVR
2012-12-20 14:51:28 +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
Pat Hickey
3f1d9d7f69
AP_Param: #include <AP_Param.h> fixups for libraries & sketches
...
* I mostly went through with grep and added an #include <AP_Param.h> below
every #include <AP_Common.h>. Not all of these example sketches might
strictly need AP_Param.
2012-12-20 14:51:19 +11:00
Andrew Tridgell
3552f3f9c5
AP_Baro: fixed example build
2012-11-24 21:07:41 +11:00
Andrew Tridgell
e331634bc5
AP_Baro: switch to SREG = oldSREG pattern for interrupt mask/restore
2012-11-20 22:31:17 +11:00
rmackay9
56f88821e9
AP_AHRS: fix example sketch
...
AP_Airspeed: fix example sketch
AP_Baro: fix example sketch
AP_Declination: fix example sketch
AP_Math: fix example sketch
2012-11-08 00:08:18 +09:00
rmackay9
1c7118a2d1
AP_Baro: added get_last_update which returns the time the barometer sensor was last read
2012-11-07 19:21:25 +09: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
4cd6657f70
uncrustify libraries/AP_Baro/AP_Baro_BMP085_hil.h
2012-08-21 19:19:51 -07:00
uncrustify
fa90f0b80f
uncrustify libraries/AP_Baro/AP_Baro.h
2012-08-21 19:00:51 -07:00
uncrustify
1196285266
uncrustify libraries/AP_Baro/AP_Baro_MS5611.h
2012-08-21 19:00:50 -07:00
uncrustify
cfcef93e16
uncrustify libraries/AP_Baro/AP_Baro_BMP085.h
2012-08-21 19:00:50 -07:00
uncrustify
5a99d6b697
uncrustify libraries/AP_Baro/AP_Baro_BMP085.cpp
2012-08-21 19:00:18 -07:00
uncrustify
b0003c020f
uncrustify libraries/AP_Baro/AP_Baro_MS5611.cpp
2012-08-21 19:00:18 -07:00
uncrustify
b39411e8d4
uncrustify libraries/AP_Baro/AP_Baro_BMP085_hil.cpp
2012-08-21 19:00:18 -07:00
uncrustify
6f02a645c3
uncrustify libraries/AP_Baro/AP_Baro.cpp
2012-08-21 19:00:18 -07:00
uncrustify
12497c51b5
uncrustify libraries/AP_Baro/examples/AP_Baro_MS5611_test/AP_Baro_MS5611_test.pde
2012-08-21 19:00:18 -07:00
uncrustify
fce9044fb4
uncrustify libraries/AP_Baro/examples/AP_Baro_BMP085_test/AP_Baro_BMP085_test.pde
2012-08-21 19:00:17 -07:00
Andrew Tridgell
c9ba693e1f
AP_Baro: the HIL baro needs to inherit calibrate() from the parent class
...
this was what caused the renorm errors
2012-08-18 16:32:23 +10:00
Andrew Tridgell
034fb5b194
APM: fixed hil build
2012-08-16 12:53:37 +10:00
Andrew Tridgell
518d6365ff
AP_Param: update remaining libraries for new constructor syntax
2012-08-08 12:11:57 +10:00
Andrew Tridgell
a7b9aff79f
AP_Baro: the DerivativeFilter now handles duplicate data
...
this saves a few bytes of memory
2012-08-08 12:07:36 +10: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
3c7e521f70
AP_Baro: update MS5611 test to use baro library altitude
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
185c6e5b32
AP_Baro: change to a 7 point DerivativeFilter for climb rate
2012-07-05 13:00:47 +10:00
Andrew Tridgell
f9fc7aafe7
AP_Baro: use DerivativeFilter in barometer climb rate
2012-07-05 13:00:46 +10:00
Andrew Tridgell
9f8703274c
AP_Baro: show climb rate in baro test sketch
2012-07-05 13:00:45 +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
f70cd71791
Baro: fixed build of MS5611 test code
2012-07-02 13:44:53 +10:00
Andrew Tridgell
5bccfbd94c
Barometer: fixed airstart for APM
...
we need to re-load the ground pressure and temperature from eeprom on
and airstart
2012-06-27 16:01:50 +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
5c9dc00ae2
AP_Baro: fixed comment to clarify that every-other call updates temperature or pressure
2012-06-03 17:31:17 +09:00
Andrew Tridgell
88b2139d91
Baro: added suspend/resume on init
2012-05-01 12:06:54 +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
486c56ce41
Consolidated Barometer pressure sensing to a single filter based on Randy's new filter class.
2012-03-08 23:13:04 -08: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
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
Randy Mackay
b7ce7bfe18
Arduino 1.0 - small fix to make AP_Baro_MS5611_test.pde compile under Arduino 1.0
2012-01-28 13:21:35 +09:00
Randy Mackay
ed19c25a97
Arduino 1.0 - changed all #includes of "WProgram.h", "wiring.h" and "WConstants.h to "Arduino.h".
...
Modified FastSerial's write function to return size_t (number of bytes written).
2012-01-28 12:25:47 +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
074fd31506
Baro: fixed MS5611 example sketch
2011-12-28 21:49:29 +11:00
Andrew Tridgell
f871235480
Baro: show timing in baro test
2011-12-28 21:43:52 +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
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
Andrew Tridgell
3648c81dd9
barometer: fixed HIL barometer build
2011-12-12 15:14:55 +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
a626e21e98
AP_Baro_BMP085: move apm2_hardware flag from init to constructor.
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
1bfab64543
AP_Baro_BMP085: Delete commented out code
...
* If its important to get old code back, thats why version control exists
2011-12-11 15:21:09 -08:00
Pat Hickey
f3270b7f13
AP_Baro_BMP085: implement AP_Baro interface
2011-12-11 15:21:09 -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
f0ab0318b3
AP_Baro_BMP085: Conform to AP_Baro interface. Make the rest private.
2011-12-11 15:21:09 -08:00
Pat Hickey
a41b6da263
AP_Baro_MS5611: conform to AP_Baro interface
2011-12-11 15:21:09 -08:00
Pat Hickey
d113992c10
AP_Baro: Create virtual 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
cc6837cbab
AP_Baro: Export AP_Baro_BMP085 and AP_Baro_BMP085_HIL headers.
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
Pat Hickey
9250053bfe
Added AP_Baro and AP_Baro_MS5611 classes.
...
Incomplete and does not work.
2011-12-11 15:21:08 -08:00