Merge pull request #43 from DTFUHF/betaflight-no-i2c-target-fix
Prevent startup crash on targets without any I2C sensors
This commit is contained in:
commit
2492601727
|
@ -83,7 +83,11 @@ mpuDetectionResult_t *detectMpu(const extiConfig_t *configToUse)
|
||||||
// MPU datasheet specifies 30ms.
|
// MPU datasheet specifies 30ms.
|
||||||
delay(35);
|
delay(35);
|
||||||
|
|
||||||
|
#ifndef USE_I2C
|
||||||
|
ack = false;
|
||||||
|
#else
|
||||||
ack = mpuReadRegisterI2C(MPU_RA_WHO_AM_I, 1, &sig);
|
ack = mpuReadRegisterI2C(MPU_RA_WHO_AM_I, 1, &sig);
|
||||||
|
#endif
|
||||||
if (ack) {
|
if (ack) {
|
||||||
mpuConfiguration.read = mpuReadRegisterI2C;
|
mpuConfiguration.read = mpuReadRegisterI2C;
|
||||||
mpuConfiguration.write = mpuWriteRegisterI2C;
|
mpuConfiguration.write = mpuWriteRegisterI2C;
|
||||||
|
|
Loading…
Reference in New Issue