Skip to content

Conversation

@peterbarker
Copy link
Contributor

Well, Claude was happy.

● Based on my comprehensive analysis of the generated hwdef.h files, I don't see any problems with your changes. Here's what I found:

  Summary of Changes

  Your modifications correctly convert compass probe definitions from the old add_backend format to new wrapper functions:

  Old format:
  add_backend(DRIVER_XXX, AP_Compass_XXX::probe(GET_I2C_DEVICE(bus,addr), external, rotation))

  New format:
  probe_i2c_dev(DRIVER_XXX, AP_Compass_XXX::probe, bus, addr, external, rotation)

  Verification Results

  1. Correct handling of different probe signatures:
    - Standard compasses (HMC5843, IST8310, RM3100, etc.): Use 5-parameter probe_i2c_dev/probe_spi_dev with external flag
    - Special compasses (LSM303D, AK8963 direct): Correctly use 4-parameter "noexternal" variant
    - MPU/ICM auxiliary compasses (AK8963 via MPU9250, AK09916 via ICM20948): Use dedicated wrapper functions
  2. Syntax validation:
    - All 315 compass probe lines were converted (matched count)
    - All parentheses are balanced
    - All lines end with RETURN_IF_NO_SPACE;
    - No malformed syntax detected
  3. Wrapper function existence:
    - Verified all wrapper functions exist in libraries/AP_Compass/AP_Compass.cpp (lines 1613-1656)
    - Confirmed overloaded versions handle both standard and "noexternal" probe signatures
  4. Sample checks across board types:
    - Pixhawk variants: ✓
    - Cube variants: ✓
    - Peripheral boards: ✓
    - Various compass types (I2C, SPI, auxiliary): ✓

  The changes appear to be production-ready with no issues detected.
Board                    AP_Periph  blimp  bootloader  copter  heli  iofirmware  plane  rover  sub
CubeOrange-periph-heavy  16                *
Durandal                            *      *           *       *                 *      *      *
Hitec-Airspeed           *                 *
KakuteH7-bdshot                     *      *           *       *                 *      *      *
MatekF405                           *      *           *       *                 *      *      *
Pixhawk1-1M-bdshot                  120                128     128               128    120    128
SITL_x86_64_linux_gnu               *                  *       *                 *      *      *
f103-QiotekPeriph        -344              *
f303-MatekGPS            72                *
f303-Universal           -8                *
iomcu                                                                *
revo-mini                           72     *           72      72                72     72     72
skyviper-v2450                                         80
speedybeef4                         *      *           *       *                 *      *      *

A useful test is to use ./Tools/scripts/configure_all.py --copy-hwdef old-hwdefs --stop on master and similarly on this branch and then diff -ur on the two directories to see the difference.

Will be testing on hardware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

1 participant