From 8cea9a3beb93566c1f318b2793bd85e2ebeaedfd Mon Sep 17 00:00:00 2001 From: timo Date: Wed, 23 May 2018 20:30:59 +0200 Subject: [PATCH] HAL_F4Light: Fixed I2C initalization for Airspeed sensor on MatekF405CTR board --- libraries/AP_HAL_F4Light/I2CDevice.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_F4Light/I2CDevice.cpp b/libraries/AP_HAL_F4Light/I2CDevice.cpp index 6801568681..1398eb4d7a 100644 --- a/libraries/AP_HAL_F4Light/I2CDevice.cpp +++ b/libraries/AP_HAL_F4Light/I2CDevice.cpp @@ -187,13 +187,16 @@ void I2CDevice::init(){ if(_dev) { i2c_init(_dev, _offs, _slow?I2C_250KHz_SPEED:I2C_400KHz_SPEED); - }else { + }else if (s_i2c){ s_i2c->init( ); if(_slow) { s_i2c->set_low_speed(true); } } + else { // neither hardware nor software initalization was successful + return; + } _initialized=true; }