-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix missing magnetometer support on NEXUSX target #11157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: maintenance-9.x
Are you sure you want to change the base?
Fix missing magnetometer support on NEXUSX target #11157
Conversation
The NEXUSX target was missing USE_MAG definition, which caused all magnetometer-related CLI settings to be unavailable. Users received "Invalid name" errors when attempting to configure align_mag_roll, align_mag_pitch, align_mag_yaw, and other compass settings. Changes: - Added USE_MAG to NEXUSX target.h - Configured MAG_I2C_BUS to use I2C3 (same bus as barometer) - Enables external magnetometer support for GPS navigation Hardware compatibility: - NEXUSX has I2C3 available (SCL: PA8, SDA: PC9) - Barometer already on I2C3 (SPL06) Testing: - Built NEXUSX target successfully - Verified settings present in binary via strings command - All compass settings now available in settings table: * align_mag_roll, align_mag_pitch, align_mag_yaw * mag_hardware, mag_declination * magzero_x/y/z, maggain_x/y/z * mag_calibration_time
PR Compliance Guide 🔍All compliance sections have been disabled in the configurations. |
|
Something to be aware of @functionpointer |
| #define USE_MAG | ||
| #define MAG_I2C_BUS BUS_I2C3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Add a definition for the specific magnetometer hardware driver (e.g., USE_MAG_QMC5883L) to ensure the device is properly initialized, as simply defining USE_MAG is insufficient. [possible issue, importance: 9]
| #define USE_MAG | |
| #define MAG_I2C_BUS BUS_I2C3 | |
| #define USE_MAG | |
| #define MAG_I2C_BUS BUS_I2C3 | |
| #define USE_MAG_QMC5883L // Or other magnetometer type used on this board |
| #define BARO_I2C_BUS BUS_I2C3 | ||
| #define USE_BARO_SPL06 | ||
|
|
||
| #define USE_MAG | ||
| #define MAG_I2C_BUS BUS_I2C3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Add an explicit note or guard to document/validate the shared I2C3 usage between barometer and magnetometer to prevent accidental divergence and bus conflicts across modules and docs. [Learned best practice, importance: 6]
New proposed code:
#define USE_BARO
-#define BARO_I2C_BUS BUS_I2C3
+#define BARO_I2C_BUS BUS_I2C3 // Shares I2C3 with magnetometer
#define USE_BARO_SPL06
#define USE_MAG
-#define MAG_I2C_BUS BUS_I2C3
+#define MAG_I2C_BUS BUS_I2C3 // Shares I2C3 with barometer (SPL06)|
Why not I2C2 instead, using |
|
Now that I am properly awake, I can tell you that The only possible interface besides So use |
User description
Summary
Fixes "Invalid name" CLI error when users attempt to configure magnetometer settings on NEXUSX target.
Problem
The NEXUSX target was missing
USE_MAGdefinition, causing all magnetometer-related CLI settings to be excluded from the settings table. Users received "Invalid name" errors when trying to use:set align_mag_roll=<value>set align_mag_pitch=<value>set align_mag_yaw=<value>Root Cause
The PG_COMPASS_CONFIG parameter group in settings.yaml has
condition: USE_MAG(line 558), which excludes all magnetometer settings when USE_MAG is not defined for the target.Solution
Added magnetometer support to NEXUSX target:
#define USE_MAGto target.hMAG_I2C_BUSto use I2C3 (same bus as barometer)Hardware Compatibility
NEXUSX board has I2C3 available for external magnetometer:
Testing
✅ Built NEXUSX target successfully
✅ Verified settings present in binary via strings command
✅ All compass settings now available:
Impact
Files Changed
src/main/target/NEXUSX/target.h- Added USE_MAG and MAG_I2C_BUS definitionsPR Type
Bug fix
Description
Enables missing magnetometer support on NEXUSX target
Adds USE_MAG definition and configures MAG_I2C_BUS to I2C3
Resolves "Invalid name" CLI errors for compass settings
Allows external magnetometer configuration via I2C3 bus
Diagram Walkthrough
File Walkthrough
target.h
Enable magnetometer on I2C3 bussrc/main/target/NEXUSX/target.h
#define USE_MAGto enable magnetometer support#define MAG_I2C_BUS BUS_I2C3to configure magnetometer I2C busmag_hardware, mag_declination, etc.)