Skip to content

Commit

Permalink
AP_Rangefinder: look in buses 0/1 when Lightware I2C bus isn't defined
Browse files Browse the repository at this point in the history
  • Loading branch information
OXINARF committed Oct 9, 2017
1 parent 7e5f98b commit bb46eae
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libraries/AP_RangeFinder/RangeFinder.cpp
Expand Up @@ -618,8 +618,16 @@ void RangeFinder::detect_instance(uint8_t instance)
break;
case RangeFinder_TYPE_LWI2C:
if (state[instance].address) {
#ifdef HAL_RANGEFINDER_LIGHTWARE_I2C_BUS
_add_backend(AP_RangeFinder_LightWareI2C::detect(state[instance],
hal.i2c_mgr->get_device(HAL_RANGEFINDER_LIGHTWARE_I2C_BUS, state[instance].address)));
#else
if (!_add_backend(AP_RangeFinder_LightWareI2C::detect(state[instance],
hal.i2c_mgr->get_device(1, state[instance].address)))) {
_add_backend(AP_RangeFinder_LightWareI2C::detect(state[instance],
hal.i2c_mgr->get_device(0, state[instance].address)));
}
#endif
}
break;
case RangeFinder_TYPE_TRI2C:
Expand Down

0 comments on commit bb46eae

Please sign in to comment.