mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-12 19:10:32 +03:00
Refactor compass align defines (#14159)
* Remove unused compass align defines * Use ALIGN_DEFAULT * Use single define for custom alignment * Unify custom alignment
This commit is contained in:
parent
d8bdb23e9c
commit
578ddd16ce
1 changed files with 5 additions and 22 deletions
|
@ -158,7 +158,11 @@ void compassPreInit(void)
|
|||
#if !defined(SIMULATOR_BUILD)
|
||||
bool compassDetect(magDev_t *magDev, uint8_t *alignment)
|
||||
{
|
||||
*alignment = ALIGN_DEFAULT; // may be overridden if target specifies MAG_*_ALIGN
|
||||
#ifdef MAG_ALIGN
|
||||
*alignment = MAG_ALIGN;
|
||||
#else
|
||||
*alignment = ALIGN_DEFAULT;
|
||||
#endif
|
||||
|
||||
magSensor_e magHardware = MAG_NONE;
|
||||
|
||||
|
@ -221,9 +225,6 @@ bool compassDetect(magDev_t *magDev, uint8_t *alignment)
|
|||
}
|
||||
|
||||
if (hmc5883lDetect(magDev)) {
|
||||
#ifdef MAG_HMC5883_ALIGN
|
||||
*alignment = MAG_HMC5883_ALIGN;
|
||||
#endif
|
||||
magHardware = MAG_HMC5883;
|
||||
break;
|
||||
}
|
||||
|
@ -237,9 +238,6 @@ bool compassDetect(magDev_t *magDev, uint8_t *alignment)
|
|||
}
|
||||
|
||||
if (lis2mdlDetect(magDev)) {
|
||||
#ifdef MAG_LIS2MDL_ALIGN
|
||||
*alignment = MAG_LIS2MDL_ALIGN;
|
||||
#endif
|
||||
magHardware = MAG_LIS2MDL;
|
||||
break;
|
||||
}
|
||||
|
@ -253,9 +251,6 @@ bool compassDetect(magDev_t *magDev, uint8_t *alignment)
|
|||
}
|
||||
|
||||
if (lis3mdlDetect(magDev)) {
|
||||
#ifdef MAG_LIS3MDL_ALIGN
|
||||
*alignment = MAG_LIS3MDL_ALIGN;
|
||||
#endif
|
||||
magHardware = MAG_LIS3MDL;
|
||||
break;
|
||||
}
|
||||
|
@ -269,9 +264,6 @@ bool compassDetect(magDev_t *magDev, uint8_t *alignment)
|
|||
}
|
||||
|
||||
if (ak8975Detect(magDev)) {
|
||||
#ifdef MAG_AK8975_ALIGN
|
||||
*alignment = MAG_AK8975_ALIGN;
|
||||
#endif
|
||||
magHardware = MAG_AK8975;
|
||||
break;
|
||||
}
|
||||
|
@ -290,9 +282,6 @@ bool compassDetect(magDev_t *magDev, uint8_t *alignment)
|
|||
}
|
||||
|
||||
if (ak8963Detect(magDev)) {
|
||||
#ifdef MAG_AK8963_ALIGN
|
||||
*alignment = MAG_AK8963_ALIGN;
|
||||
#endif
|
||||
magHardware = MAG_AK8963;
|
||||
break;
|
||||
}
|
||||
|
@ -306,9 +295,6 @@ bool compassDetect(magDev_t *magDev, uint8_t *alignment)
|
|||
}
|
||||
|
||||
if (qmc5883lDetect(magDev)) {
|
||||
#ifdef MAG_QMC5883L_ALIGN
|
||||
*alignment = MAG_QMC5883L_ALIGN;
|
||||
#endif
|
||||
magHardware = MAG_QMC5883;
|
||||
break;
|
||||
}
|
||||
|
@ -322,9 +308,6 @@ bool compassDetect(magDev_t *magDev, uint8_t *alignment)
|
|||
}
|
||||
|
||||
if (ist8310Detect(magDev)) {
|
||||
#ifdef MAG_IST8310_ALIGN
|
||||
*alignment = MAG_IST8310_ALIGN;
|
||||
#endif
|
||||
magHardware = MAG_IST8310;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue