mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
Merge pull request #6121 from AlienWiiBF/QMC5883L_fix
Fix wrong QMC5883L mag detection
This commit is contained in:
commit
1fdef20bfc
1 changed files with 6 additions and 0 deletions
|
@ -135,6 +135,12 @@ bool qmc5883lDetect(magDev_t *magDev)
|
|||
uint8_t sig = 0;
|
||||
bool ack = busReadRegisterBuffer(busdev, QMC5883L_REG_ID, &sig, 1);
|
||||
if (ack && sig == QMC5883_ID_VAL) {
|
||||
// Should be in standby mode after soft reset and sensor is really present
|
||||
// Reading ChipID of 0xFF alone is not sufficient to be sure the QMC is present
|
||||
ack = busReadRegisterBuffer(busdev, QMC5883L_REG_CONF1, &sig, 1);
|
||||
if (ack && sig != QMC5883L_MODE_STANDBY) {
|
||||
return false;
|
||||
}
|
||||
magDev->init = qmc5883lInit;
|
||||
magDev->read = qmc5883lRead;
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue