diff --git a/libsweep/CMakeLists.txt b/libsweep/CMakeLists.txt index bfc1861..1caff50 100644 --- a/libsweep/CMakeLists.txt +++ b/libsweep/CMakeLists.txt @@ -6,7 +6,7 @@ project(sweep C CXX) set(SWEEP_VERSION_MAJOR 1) set(SWEEP_VERSION_MINOR 1) -set(SWEEP_VERSION_PATCH 0) +set(SWEEP_VERSION_PATCH 1) option(DUMMY "Build dummy libsweep always returning static point cloud data. No device needed." OFF) diff --git a/libsweep/src/sweep.cc b/libsweep/src/sweep.cc index ed62bcd..453fd7b 100644 --- a/libsweep/src/sweep.cc +++ b/libsweep/src/sweep.cc @@ -261,8 +261,13 @@ void sweep_device_wait_until_motor_ready(sweep_device_s device, sweep_error_s* e sweep_error_s readyerror = nullptr; bool motor_ready; - // Only check for 8 seconds (16 iterations with 500ms pause) - for (auto i = 0; i < 16; ++i) { + // Motor adjustments can take 7-9 seconds, so timeout after 10 seconds to be safe + // (20 iterations with 500ms pause) + for (auto i = 0; i < 20; ++i) { + if (i > 0) { + // only check every 500ms, to avoid unecessary processing if this is executing in a dedicated thread + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + } motor_ready = sweep_device_get_motor_ready(device, &readyerror); if (readyerror) { *error = readyerror; @@ -271,8 +276,6 @@ void sweep_device_wait_until_motor_ready(sweep_device_s device, sweep_error_s* e if (motor_ready) { return; } - // only check every 500ms, to avoid unecessary processing if this is executing in a dedicated thread - std::this_thread::sleep_for(std::chrono::milliseconds(500)); } *error = sweep_error_construct("timed out waiting for motor to stabilize"); }