Commit Graph
328 Commits
Author SHA1 Message Date
Peter Barker d3ddac74ea AP_Compass: remove HAL_CHIBIOS_ARCH_MINDPXV2
MinxPX is the only board using it, and it specifies everything
2026-01-20 10:44:35 +11:00
Peter Barker 2d2cbf49dc AP_Compass: remove HAL_CHIBIOS_ARCH_FMUV5+ 2026-01-13 11:00:56 +11:00
Peter Barker 7e87c92e0c AP_Compass: rename _have_i2c_driver to _i2c_sensor_is_registered 2026-01-03 10:10:16 +00:00
Peter Barker 096d240908 AP_Compass: move from add_backend to probe_i2c_device for MMC5XX3 2025-12-10 21:49:48 +11:00
Peter Barker 3e515f2a45 AP_Compass: use aliases to make new methods clearer 2025-12-10 21:49:48 +11:00
Peter Barker 5d15a960dc AP_Compass: use parameters rather than constants in probe_ak09916_via_icm20948 2025-12-10 21:49:48 +11:00
Peter Barker 9534069dff AP_Compass: add some helper functions for compass probing
... and stop leaking memory if the device isn't enabled
2025-12-10 21:49:48 +11:00
Peter Barker 4aa5b58de6 AP_Compass: all backends take a generic Device rather than an I2CDevice 2025-12-10 21:49:48 +11:00
Peter Barker 4ae0c0401c AP_Compass: remove internal probing of MMC5XX3 compass
these should really only ever be in the hwdef if they are internal; we don't need generic probing of these!
2025-12-07 20:25:26 +11:00
jagadeeshdinesh 0ea41a4246 AP_Compass: add support for MMC5XX3 (MMC5983MA) external I2C compasses 2025-12-05 07:30:18 +11:00
Peter Barker febcb3c1a8 AP_Compass: correct compilation for LIS2MDL/ADD_BACKEND PR crossover 2025-11-27 00:10:08 +11:00
Peter Barker 3b575e0559 AP_Compass: merge add_backend and _add_backend
folding these together makes us check the driver is enabled a little redundantly, but that's OK.
2025-11-26 20:44:21 +11:00
Peter Barker fa4e31ff14 AP_Compass: make ADD_BACKEND a method not a macro
code generation isn't great, preparation for future cleanups
2025-11-26 20:44:21 +11:00
Peter Barker 461c1b7236 AP_Compass: remove CHECK_UNREG_LIMIT_RETURN from ADD_BACKEND, rename
new name is same as in AP_Baro.  We probably want to have an elif for when we have filled up our compasses in the no-unregistered case
2025-11-26 20:44:21 +11:00
Andy Piper a2949578ed AP_Compass: support for LIS2MDL 2025-11-26 18:25:43 +11:00
bugobliterator a6d03bb8a1 AP_Compass: fix issue with compass registration for more than 3 compasses
This fixes an issue where we would fail to register a dronecan compass
if its not already in the stored DEV_ID position that matches the detection order

This is fixed by ensuring that we try our best to register the compass in the stored DEV_ID position
that matches the priority order.

This in turn allows for over 3 dronecan compasses to appear and not cause incorrect
registration failures at boot.
2025-11-26 18:05:59 +11:00
bugobliterator afdd95d34e AP_Compass: use MAX_CONNECTED_MAGS for DroneCAN registration
this allows for more than 3 DroneCAN compasses to be on the bus.
2025-11-26 18:05:59 +11:00
Peter Barker 03e1f0180c AP_Compass: tidy compass probing defines
- stop using #ifdef defines
 - use current standard naming schemes
 - remove the double-negatives
2025-11-05 19:35:27 +11:00
Peter Barker 944ef566ec AP_Compass: rename HAL_PROBE_EXTERNAL_I2C_COMPASSES to AP_COMPASS_PROBING_ENABLED
... and force it to have a value, not just be defined
2025-10-27 18:24:18 -05:00
Peter Barker a657744a2f AP_Compass: rework SITL backend to be a single-instance
rather than this odd thing which acts as multiple backends
2025-10-08 13:23:49 +11:00
Peter Barker 9ea20dc132 AP_Compass: add a MSP probe method which can fail
currently registering an MSP backend can't fail, so if we fail to register (e.g. out of slots) then we can end up overwriting other's data.

Add a probe method which can return nullptr on failure
2025-09-30 15:10:09 +10:00
Peter Barker 39a4032f70 AP_Compass: add a probe method to AP_Compass_ExternalAHRS
this allows for the creation of the backend to fail gracefully

without this the backend will still have a value of 0, and will still get updated, overwriting the data for one of the registered compasses
2025-09-23 08:59:56 +09:00
Peter Barker 8189f7693e AP_Compass: remove remaining vrbrain FMU architectures and PX4_BOARD_TYPEs 2025-06-25 18:17:19 +10:00
Peter Barker 17bd219c7f AP_Compass: remove support for SP01 board
there's no automatic setting for this board, so it would have been selected by parameter only.

This was a development board pre-PCNC01 - it wasn't widely distributed.

If we want this back we can create a full-on board for it...
2025-06-24 10:38:58 +10:00
Peter Barker 162e2e0ff4 AP_Compass: remove PCNC1 board type
only used for one board, so inline everything required
2025-06-17 10:59:00 +10:00
Peter Barker 88d0bdb1bf AP_Compass: move VRBrain-v54 sensors to hwdef 2025-06-11 17:22:55 +10:00
Peter Barker 9fe7f960b1 AP_Compass: remove dead sensor detect code
these boards specify their internal devices so don't cross these paths
2025-06-10 16:28:17 +10:00
muramura 012e727dfc AP_Compass: Specify the names of the supported devices 2025-06-07 10:46:51 +10:00
Peter Barker 3b09612552 AP_Compass: remove unnueccesary HAL_BUILD_AP_PERIPH check 2025-05-13 18:48:05 +01:00
Peter Barker 6298f7dc58 AP_Compass: make compass LearnType enum-class and parameter AP_Enum 2025-01-29 19:21:59 +11:00
Peter Barker 9e4a180878 AP_Compass: remove vestiges of LearnType::LEARN_INTERNAL
57a3bc1397 changed the code from "internal" to "in-flight

It seems the old value of "1" was no longer valid

It also changed things to that the learning system saved the offsets.
2025-01-28 12:23:53 +11:00
Jacob Dahl 64bb0ad762 AP_Compass: add IIS2MDC driver 2025-01-15 19:10:16 +11:00
Dr.-Ing. Amilcar do Carmo Lucas 6a59d3adae AP_Compass: Also mark Z axis as calibrations, just like the XY 2024-11-05 09:25:59 +09:00
muramura 0020cf5fe8 AP_Compass: Add existing devices 2024-09-22 10:11:50 +10:00
cuav-chen2 89a4571c58 AP_Compass: Add in BMM350 Driver 2024-09-21 10:08:36 +10:00
Peter Barker 42b8ee78cf AP_Compass: remove use of AP_AHRS from most headers
don't need to know the details, just that it is a class
2024-09-03 10:35:54 +10:00
Peter Barkerandmuramura fa4e90a3bb AP_Compass: use GCS_SEND_TEXT rather than gcs().send_text
Co-authored-by: muramura <ma2maru@gmail.com>
2024-08-07 18:33:16 +10:00
Andrew Tridgell 0f08b47322 AP_Compass: use NEW_NOTHROW for new(std::nothrow) 2024-06-04 09:20:21 +10:00
Peter Barker 093deed610 AP_Compass: add and use AP_CUSTOMROTATIONS_ENABLED
also add to build_options.py
2024-03-03 08:22:46 +11:00
Peter Barker c36b57acba AP_Compass: exclude cpp files if not AP_COMPASS_ENABLED 2024-02-27 11:02:48 +11:00
Peter Barker ecc7188d97 AP_Compass: rename COMPASS_TYPEMASK to COMPASS_DISBLMSK
this is a very confusingly named parameter.  I've seen several instances of people treating this as an enable mask rather than a disable mask
2024-01-23 11:54:49 +11:00
Jonathan Loong 0db1719c8f AP_Compass: Add in QMC5883P Driver 2023-11-15 10:53:38 +11:00
Andrew Tridgell 598e2b0762 AP_Compass: remove more exposed params for periph
these parameters are not useful on peripherals which use raw mag field
2023-11-08 18:34:41 +11:00
Andrew Tridgell 422d7cec6e AP_Compass: probe DroneCAN compasses before I2C
it is highly likely that a user with a DroneCAN compass will want it
to be earlier in the dev list than i2c or spi compasses
2023-10-31 10:14:42 +11:00
Andrew Tridgell 36de6613fb AP_Compass: split out probing code into i2c+spi and DroneCAN
this is a NFC to make the PR clearer
2023-10-31 10:14:42 +11:00
Andrew Tridgell 9fc9238c53 AP_Compass: prevent saving of device IDs when not calibrated
this fixes an issue with the following sequence:

 - new board (or board with FORMAT_VERSION reset) starts up with only internal compasses
 - internal compasses are detected and devids saved
 - an external compass is added and the board is rebooted
 - the external compass will not be the first compass
 - user then calibrates and flies, but has internal as primary

this can lead to a very bad experience for new users. At least one
vehicle has crashed due to this sequence.

The fix is to not save device IDs during the Compass::init() if we
have never been calibrated. This means that when an external compass
is added it will come up as the first compass.

This also removes the saving of the extra device ID. It was never
intended that these be saved (there is a comment to that effect in the
code), but actually they were saved.
2023-10-31 10:14:42 +11:00
Iampete1 83a31ac371 AP_Compass: add big comment explaining calculate_heading maths, add consts and use wrap_PI helper 2023-10-25 15:57:16 +01:00
Andrew Tridgell e1fad5ee38 AP_Compass: allow override of IST8310 orientation
this allows for vendor GPS modules and internal compass which use a
different orientation
2023-08-06 09:23:45 +10:00
Iampete1 262b11f0c1 AP_Compass: stop auto replacing missing CAN by default, add option to re-enable 2023-06-27 09:24:41 +10:00
Hayden fa800e23e2 AP_Compass: Move health to cpp and add range check
Moved the health check to the cpp file and added checking of max instances
2023-05-24 12:39:47 +10:00