Commit Graph
1126 Commits
Author SHA1 Message Date
Andy Piper d2d8aa527b AP_Compass: remove unused private field
Remove unused _compass_instance field to fix clang
-Wunused-private-field warning.
2026-01-26 13:13:55 -06:00
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 b64a5f3a04 AP_Compass: add an init method to SITL::SIM
constructor ordering can mean that we construct SITL::SIMi before we construct SITL::AirspeedParm::varinfo

That leads to parameters not being initialised as there is no GroupInfo structure for the populate-from-defaults code to walk.

That can lead to division-by-zero when we divide by the simulated airspeed ratio.
2025-12-09 10:09:03 +11:00
Thomas Watson ff75b7b1d6 AP_Compass: remove probing failure message on MMC5XX3 compass
Avoids a meaningless print on every board which does not have one of
these compasses now that we probe them.
2025-12-07 10:19:22 -06: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
Peter Barker 458a99dd25 AP_Compass: enable MMC5XX3 only on boards with >1024kB
out of space on Pixhawk1-1M.  boards which include this in their hwdef will still get the driver, but it won't be available for external probing on 1MB boards.
2025-12-05 07:30:18 +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 e03e899219 AP_Compass: use ARRAY_SIZE for _detected_modules loop bounds 2025-11-26 18:05:59 +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
muramura 281c80c2f0 AP_Compass: Change the maximum and minimum values of the type to named constants 2025-11-05 18:05:53 +11:00
Bob Long cdd68c60a8 AP_Compass: move stale define check to hwdef.py 2025-10-28 07:48:43 +00: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
cuav-chen2 3efb5697f9 AP_Compass: Fix BMM350 temperature calculation 2025-10-20 22:36:38 +11:00
Peter Barker dabcf0e91c AP_Compass: make compass instance number part of AP_Compass_Backend
rather than each backend storing this itself.

This allows many methods to assume that they are working on the current instance number rather than being passed the instance number

registering the compass via the compass backend method now infers setting the device ID
2025-10-14 14:48:58 +11:00
Peter Barker 3ec77fa503 AP_Compass: examples: zero all compass offsets rather than just instance zero
makes the output less mysterious
2025-10-08 13:23:49 +11:00
Peter Barker cd7ee68894 AP_Compass: correct example under SITL
zero instances were found on master, this makes it work
2025-10-08 13:23:49 +11: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 51fbd53473 AP_Compass: check return value of register_compass in AP_Compass_MSP
if we don't do this then we can end up overwriting someone else's data

... and make sure these bugs don't come back by using WARN_IF_UNUSED
2025-09-28 12:42:49 +01: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
Thomas Watson d5ff9cfcfe AP_Compass: remove isolated bool bitfields
These save no memory yet require extra instructions.
2025-09-17 08:34:10 -05:00
Peter Barker 57688f5e03 AP_Compass: use get_roll_deg in place of degrees(get_roll_rad) etc. 2025-08-05 09:00:08 +09:00
Peter Barker 3708936c62 global: correct shebang lines to refernce python3
also remove the odd encoding line which is not required in Py3
2025-07-22 10:45:57 +10: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 521de42cf7 AP_Compass: rename AHRS get_roll etc accessors to include _rad 2025-06-05 17:28:41 +10:00
Peter Barker ea11c1053d AP_Compass: remove line feeds from GCS_SEND_TEXT calls
these often make their way in when moving from some other printf-style debugging...
2025-05-30 22:36:07 +10:00
Peter Barker 224dbc4ac7 AP_Compass: replace ToRad with radians and ToDeg with degrees 2025-05-29 11:24:56 +10:00
Peter Barker 652b7369f0 AP_Compass: have AK09916-via-ICM20948 depend on AP_INERTIALSENSOR_ENABLED 2025-05-13 18:48:05 +01:00
Peter Barker 3b09612552 AP_Compass: remove unnueccesary HAL_BUILD_AP_PERIPH check 2025-05-13 18:48:05 +01:00
Peter Barker a294713975 AP_Compass: rename HAL_EXTERNAL_AHRS_ENABLED to AP_EXTERNAL_AHRS_ENABLED
in preparation for making this an optional feature; a lot of people will want to go and put this in their hwdef files as soon as we do this!
2025-05-13 09:06:44 +09:00
muramura 1e791e9dcd AP_Compass: Remove the external reference to HAL 2025-05-06 08:39:32 +10:00