From 0f6b8375bbc99c8cd1c461e260d868906fc39211 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 19 Jul 2019 16:56:40 +1000 Subject: [PATCH] AP_RangeFinder: added a 1.5 delay to probe of LW20 I2C the LW20 takes a long time to boot and be ready to probe --- libraries/AP_RangeFinder/RangeFinder.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/AP_RangeFinder/RangeFinder.cpp b/libraries/AP_RangeFinder/RangeFinder.cpp index c10e3fabab..feb5cd4074 100644 --- a/libraries/AP_RangeFinder/RangeFinder.cpp +++ b/libraries/AP_RangeFinder/RangeFinder.cpp @@ -380,6 +380,10 @@ void RangeFinder::detect_instance(uint8_t instance, uint8_t& serial_instance) break; case RangeFinder_TYPE_LWI2C: if (params[instance].address) { + // the LW20 needs a long time to boot up, so we delay 1.5s here + if (!hal.util->was_watchdog_armed()) { + hal.scheduler->delay(1500); + } #ifdef HAL_RANGEFINDER_LIGHTWARE_I2C_BUS _add_backend(AP_RangeFinder_LightWareI2C::detect(state[instance], params[instance], hal.i2c_mgr->get_device(HAL_RANGEFINDER_LIGHTWARE_I2C_BUS, params[instance].address)));