Lucas De Marchi
a66a201bf5
AP_Compass: HMC5843: Add support for MPU6000 auxiliary bus
...
Allow HMC5843 to be on MPU6000's auxiliary bus.
2015-08-28 12:39:09 +10:00
Lucas De Marchi
628e446e3e
AP_Compass: HMC5843: use a struct for raw value
...
Like is done in AK8963, declare a raw_value struct.
2015-08-28 12:39:09 +10:00
Lucas De Marchi
9ecd1daf81
AP_Compass: HMC5843: remove useless delay
...
There's no need to add a delay after suspending timer in the
initialization. Also initialize _bus_sem earlier, like is done in
AK8963.
2015-08-28 12:39:09 +10:00
Lucas De Marchi
c66c9c41f2
AP_Compass: HMC5843: be agnostic to I2C bus
...
Like was done to inertial AK8963 and inertial sensor move the decision
regarding the I2C bus to the caller. We don't allow changing the address
because apparently HMC5843 doesn't support different addresses.
Changing only the bus could be more easily done but this prepares the
ground for using HMC5843 on an AuxiliarBus.
The need for a more generic abstraction is evidenced by this commit: a
"SerialBus" in AP_HAL would be a nice addition rather than letting each
driver to provide its own. However the methods are a little bit
different from what we have in AK8963. It's safer to do the simple
conversion now and later on to add the abstraction changing everybody to
use it.
2015-08-28 12:39:09 +10:00
Staroselskii Georgii
3eb6be64c9
AP_Compass: ignore first two readings in a clearer way
...
This way we don't mix two different conditionals: settling and data validation.
2015-08-28 12:39:09 +10:00
Staroselskii Georgii
633330db14
AP_Compass: rename calibration array in HMC
...
I think naming the variable "scaling" makes more sense.
2015-08-28 12:39:09 +10:00
Staroselskii Georgii
d8bddcbf3a
AP_Compass: fix indentation in HMC's driver
2015-08-28 12:39:09 +10:00
Staroselskii Georgii
79ffddc6db
AP_Compass: add a macro for checking calibration values in HMC
2015-08-28 12:39:08 +10:00
Lucas De Marchi
f61386ae43
AP_Compass: HMC5843: release the lock before read
...
read() calls accumulate() which takes the lock by itself so we must
release it like we were doing before 669ae26 ("AP_Compass: encapsulated
calibration in HMC").
2015-08-28 12:39:08 +10:00
Staroselskii Georgii
a9e8c1c464
AP_Compass: encapsulated calibration in HMC
2015-08-28 12:39:08 +10:00
Staroselskii Georgii
0fbc295d97
AP_Compass: encapsulated version detection in HMC driver
2015-08-28 12:39:08 +10:00
Gustavo Jose de Sousa
58f300e78e
AP_Compass: 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
Randy Mackay
66469d7529
Compass_HMC5843: remove unnecessary i2c semaphore give
2015-08-07 15:50:36 +09:00
Randy Mackay
d192b3ccea
Compass: set device id for ak8963 and hmc5843
2015-07-06 21:04:46 +09:00
Tom Pittenger
16e71ec1ce
Compass: fix compile warning re member init order
2015-04-24 14:15:00 +09:00
Tom Pittenger
bf1d128d70
Compass: fix compile warnings re float constants
...
Also fix example sketch
2015-04-24 12:29:07 +09:00
Andrew Tridgell
1962706a33
AP_Compass: fixed last_update, using last_update_usec()
...
this broke use of compass in the EKF
2015-03-14 12:31:23 +11:00
Andrew Tridgell
7b51c907f5
AP_Compass: zero some more variables in constructor and init
2015-03-13 19:22:11 +11:00
Andrew Tridgell
0efd3bacea
AP_Compass: make new backend match old PX4 behaviour
...
when a compass is internal only apply board orientation, not user
specified rotation
2015-03-13 18:46:15 +11:00
Andrew Tridgell
a871c87cad
AP_Compass: use state array for compass variables
2015-03-13 18:46:15 +11:00
Víctor Mayoral Vilches
13f0aa5ecd
AP_Compass: Separate common code into backend
...
_copy_to_frontend function takes care of abstracting
this code from the driver. For now the function takes
care of the offset and rotation that is common.
2015-03-13 18:46:15 +11:00
Víctor Mayoral Vilches
d3b76cd8d3
AP_Compass: split compass into frontend/backend
2015-03-13 18:46:15 +11:00
Staroselskii Georgii
7f00dd413f
AP_Compass: fixed HMC5883's initialisation code
2014-11-14 10:21:04 +11:00
Jonathan Challinger
9054dd3f9a
AP_Compass: use apply_correction_function to eliminate duplication
2014-10-19 17:02:45 +11:00
Randy Mackay
86aac4f40c
Compass_HMC5843: use instance specific orient and external
2014-10-01 13:02:03 +10:00
Andrew Tridgell
54562b0b9a
AP_Compass: prevent bad initial values from affecting HMC5883 calibration
...
the first couple of values after we enter strap mode may be low, but
just above our 0.7 threshold. We now discard the first two values to
prevent these affecting the average.
Also added some commented out debug code and a comment on the scaling
of the calibration code
2014-01-22 17:15:34 +11:00
Andrew Tridgell
61f564d7c9
AP_Compass: support motor compensation for multiple compasses
...
Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-12-09 19:45:31 +11:00
Andrew Tridgell
c538816825
AP_Compass: support compass health status on multiple compasses
2013-12-09 17:46:41 +11:00
Andrew Tridgell
bde89fd4e2
AP_Compass: added compass offsets for 2nd compass
2013-12-09 17:34:07 +11:00
Andrew Tridgell
8a97042fb1
AP_Compass: updates to support multiple compasses
2013-12-09 17:34:07 +11:00
Andrew Tridgell
cb16733918
AP_Compass: switched to a vector based interface
...
this is more consistent with other APIs and makes multi-device support
easier
2013-12-09 17:34:06 +11:00
Randy Mackay
84fdff4cd6
Compass: slightly relax HMC5843 calibration limits
...
Some users have reported Z axis values as high as 1.33. Their compasses
seem otherwise health so extending the limits slightly.
2013-11-27 15:36:34 +09:00
Andrew Tridgell
1ccd6bb7ef
AP_Compass: don't wait more than 1ms for compass sample
...
this prevents 5ms delays in compass accumulate
2013-10-08 11:50:54 +11:00
Andrew Tridgell
83c942a512
AP_Compass: prevent NULL deref on enable mag while running
2013-10-08 11:50:53 +11:00
Andrew Tridgell
da14ad2e2d
AP_Compass: neaten up HMC5883 debug
2013-09-28 21:24:02 +10:00
Andrew Tridgell
6fc5b06043
AP_Compass: fixed some old Serial.print calls
2013-09-28 21:24:02 +10:00
Mike McCauley
4c65c42411
AP_Compass: fixed ARM 32 bit compatibility
2013-09-23 18:10:21 +10:00
Andrew Tridgell
fbf79c07f0
AP_Compass: added COMPASS_EXTERNAL option
...
this allows configuring of a compass as being externally attached
2013-08-30 14:02:09 +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
217f34e155
AP_Compass: added COMPASS_ORIENT parameter, to support external compasses
...
this allows the user to configure the compass for any orientation
supported by our rotation library
2013-05-02 12:48:14 +10:00
Christopher Hrabia
9760cdf2d7
Compass: corrected space
2013-03-18 14:27:49 +09:00
Randy Mackay
b8d492b504
Compass: current based compensation added
2013-03-03 23:02:12 +09:00
Randy Mackay
bfb29ce22b
Compass: remove virtual functions to save RAM
2013-03-02 00:07:32 +09:00
Randy Mackay
d8515ff85e
Compass: basic compensation for motor interference
2013-03-02 00:03:16 +09: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
60a4447a86
AP_Compass: added set_board_orientation() method
2013-01-13 17:32:48 +11:00
Andrew Tridgell
8f424cdf21
AP_Compass: ensure we check we got the semaphore
2013-01-09 20:42:20 +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
b70f7f57ba
AP_Compass: restore low speed change on register read failure
2012-12-20 14:51:37 +11:00