Commit Graph

94 Commits

Author SHA1 Message Date
Thomas Watson
b8d50b112a AP_Compass: fix C++ One Definition Rule violations
Two structs with the same name must have exactly the same definition, no
matter where they occur in the program, otherwise the program is undefined.

Move each sample register struct definition into the associated class
definition so they are in a different namespace and no longer
identically named, thus fixing this issue.
2023-11-21 13:21:03 +11:00
Peter Barker
22feb3c08a AP_Compass: add and use AP_COMPASS_AK8963_ENABLED 2023-02-07 10:21:06 +11:00
Peter Barker
c0d9201740 AP_Compass: rename HAL_INS_ENABLED to AP_INERTIALSENSOR_ENABLED 2023-01-03 10:28:42 +11:00
murata
a19d4b65fc AP_Compass: Console output can be disabled 2022-05-17 09:53:06 +10:00
Tom Pittenger
d45526ff42 AP_Compass: fix periph-heavy compile errors with different things enabled 2021-09-24 10:47:13 -05:00
Andrew Tridgell
0f5dd40052 AP_Compass: removed assert calls
these waste flash space and do not do us any good
2021-03-25 14:03:40 +11:00
Siddharth Purohit
8d227d401a AP_Compass: modify compass driver to support consistent ordering and hotplugging 2020-02-19 13:59:53 +09:00
Andrew Tridgell
521cf4d6a1 AP_Compass: removed annoying startup messages
these happen due to sensor probing for older configs
2020-02-06 15:25:46 -07:00
Andrew Tridgell
4ee6fb9cdf AP_Compass: use take_blocking instead of HAL_SEMAPHORE_BLOCK_FOREVER
this makes for cleaner and smaller code as the failure case is not
needed
2020-01-19 20:19:30 +11:00
Andrew Tridgell
9e7929adf6 AP_Compass: removed unusued AP_Common/Semaphore.h 2019-05-15 15:33:48 +10:00
Tom Pittenger
2cd485e7ae AP_Compass: unify singleton naming to _singleton and get_singleton() 2019-02-10 19:09:58 -07:00
Andrew Tridgell
579a84b53e AP_Compass: use new accumulate functions for AK8963 2018-10-19 16:03:45 +11:00
Andrew Tridgell
a260792e9e AP_Compass: use WITH_SEMAPHORE()
and removed usage of hal.util->new_semaphore()
2018-10-17 12:54:22 +11:00
Lucas De Marchi
4039b51810 AP_Compass: stop passing frontend pointer
Let AP_Compass_Backend call AP::compass() *once* instead of passing
the frontend pointer over and over.
2018-09-06 08:23:02 +10:00
Lucas De Marchi
d5f57fdd93 AP_Compass: AK8963: remove fallback to timer thread
Now that the bus thread from the AuxiliaryBus is implemented we can
remove the fallback.
2017-09-11 09:52:41 -07:00
Michael du Breuil
fb77d0739e AP_Compass: Remove unused time calls, stash the time in the read loop 2017-09-07 19:53:14 +01:00
Lucas De Marchi
6bab28397a AP_Compass: remove user of timesliced logic 2017-08-02 08:00:53 -07:00
murata
bc7b2144e7 AP_Compass: Change from magic number 0 to definition name. 2017-02-18 14:12:36 +00: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
Andrew Tridgell
790d186c6c AP_Compass: switched to unified Invensese driver for AK8963 2016-12-16 12:31:34 +11:00
Andrew Tridgell
bd8867be38 AP_Compass: cope with NULL dev pointer in driver probe functions 2016-11-09 17:08:11 +11:00
Andrew Tridgell
05769640d1 AP_Compass: support rotations on AK8963 2016-11-09 17:08:08 +11:00
Andrew Tridgell
147b253e65 AP_Compass: make device IDs match PX4 drivers
match in-tree drivers to PX4Firmware drivers
2016-11-09 17:08:06 +11:00
Andrew Tridgell
de7913e8e9 AP_Compass: implement device IDs for compass drivers 2016-11-09 17:08:04 +11:00
Andrew Tridgell
1c631ea037 AP_Compass: cleanup use of backend semaphores
fixed drivers that didn't protect accumulation counters
2016-11-09 17:08:01 +11:00
Andrew Tridgell
9afd51350e AP_Compass: use thread per bus in more drivers
and removed use of timer suspend
2016-11-09 17:08:01 +11:00
Andrew Tridgell
974827aa82 AP_Compass: enabled AK8963 on PX4 2016-11-09 17:08:01 +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
Andrew Tridgell
f82827ce79 AP_Compass: removed disco special compass offsets
not needed any more with newer hardware
2016-09-14 19:06:06 +10:00
Andrew Tridgell
018d8f732a AP_Compass: work around poor magnetic setup on Disco
bring compass offsets into line with what the calibrator can handle
2016-07-20 13:38:17 +10:00
Lucas De Marchi
20a4a42cb3 AP_Compass: don't store raw and unfiltered fields
These are not used. The only place where raw fields are used are in the
compass calibrator and we don't need to store them.

Additionally remove duplicated documentation about the meaning of the
functions to avoid them getting out of sync.
2016-03-23 17:50:38 -03:00
Lucas De Marchi
d3831dbb98 AP_Compass: AK8963: use AP_HAL::I2CDevice abstraction
We still need the BusDriver (in some places called SerialBus) interface
since this driver can also be used on an AuxiliaryBus and that has a
different interface.
2016-03-23 17:50:38 -03:00
Lucas De Marchi
02a7fa5c2b AP_InertialSensor: MPU9250: use AP_HAL::Device abstraction
This makes MPU9250 be almost the same as MPU6000 driver. Work has been
done here to make than similar so it's easier to spot the differences.
2016-02-16 19:49:09 -02:00
Lucas De Marchi
b55294920b AP_Compass: AK8963: remove logging on fail to get semaphore
This is the only driver doing this, using the system_initializing() from
scheduler to log selectively. Remove the check together with removal of
unused wrapper methods to semaphore.
2016-02-08 13:28:32 -02:00
Julien BERAUD
45d668df47 AP_Compass_AK8963: support for timesliced timers
fallback in case the current scheduler doesn't support it
2016-01-18 16:57:48 -02:00
Caio Marcelo de Oliveira Filho
0d3fbbdd37 AP_Compass: use millis/micros/panic functions 2015-11-20 12:30:05 +09:00
José Roberto de Souza
bdc36349b4 AP_Compass: AK8963: Add support to use a AK8963 behind of a MPU9250 over I2C
To be able to use AK8963 connected to the auxiliary I2C bus of a
MPU9250 we need first initialize it.
2015-11-11 14:29:07 +11:00
José Roberto de Souza
1fc29a2654 AP_Compass: AK8963: Use MPU9250 auxiliary bus 2015-11-11 14:29:06 +11:00
Gustavo Jose de Sousa
9927cf066f AP_Compass: remove use of milligauss_ratio
Now, we have all current compasses publishing their values already in
milligauss, so there's no need for that variable anymore.
2015-10-15 19:56:14 +09:00
Gustavo Jose de Sousa
b603641d7c AP_Compass: AK8963: fix where to apply sensitivity adjustments
The function rotate_field() can change the values axes and the function
correct_field() applies offsets (which are already in milligauss). Thus any
sensitivity adjustment must be done for two reasons:

    (1) The offsets must be applied to the values already in milligauss;
    (2) The factory sensitivity adjustment values are per axis, if any rotation
        that switches axes is applied, that'll mess with the adjustment.

Experiments showed that before this patch the length of the mag field reported
quite different from the expected. After this patch, the same experiments
showed reasonable values.
2015-10-15 19:56:13 +09:00
Gustavo Jose de Sousa
6198e81bb3 AP_Compass: AK8963: scale mag field internally
This is part of the transition to make all mag field values be used in
milligauss.
2015-10-15 19:56:12 +09:00
mirkix
ddb8e67954 AP_Compass: Add support for more then one AK8963 2015-10-06 10:38:21 +11:00
José Roberto de Souza
a9d34ac3bd AP_Compass: AK8963: Rename some SPI/I2C method parameters
On read/write operations the argument is the register that will be read or
write not the address, SPI don't even have the concept of device address.
2015-10-01 10:42:40 -03:00
mirkix
eee9522ca5 AP_Compass: Add MPU9250 multiple instance support 2015-09-24 13:11:38 +10:00
Julien BERAUD
5602e4055b AP_Compass_AK8963: Fix Rotation on the Bebop 2015-09-15 14:45:17 +09:00
Andrew Tridgell
c59bdc12df AP_Compass: fix the milligauss handling
the previous approach assumed a 1:1 mapping between compass backends
and compass instances, which isn't true on PX4.

It also only setup milligauss offsets on a set_and_save call, which is
not the only way offsets change

this adds a milligauss_ratio per instance, which is considerably
simpler
2015-09-09 14:53:11 +10:00
Staroselskii Georgii
693613aa0f AP_Compass: convert AK8963 measurements to uT
AK8963 is configured in 16-bit ADC mode which implies sensitivity of 0.15 uT/LSb. Knowing this fact we can convert the measurements to the proper units. The change will make users recalibrate their compasses.
2015-09-09 10:38:16 +10:00
Staroselskii Georgii
c207d8c6a8 AP_Compass: add milligauss counterparts to get_field() and get_offsets()
From now on there's a pair get_field_milligauss() and
get_offsets_milligauss() that can make the transition to the common
units across all compasses easier.
2015-09-09 10:38:16 +10:00
Andrew Tridgell
079161ef3a AP_Compass: fixed raw_field init in AK8963 driver
thanks to Peter for spotting this
2015-09-03 21:27:22 +10:00
Siddharth Bharat Purohit
63973bff31 AP_Compass_AK8963: move variable declarations before goto 2015-09-03 16:59:14 +10:00