1
0
Fork 0
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:
Michael Keller 2018-06-17 13:36:02 +12:00 committed by GitHub
commit 1fdef20bfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;