Skip to content

Commit

Permalink
Increased wait time for motor calibration to support internal revisio…
Browse files Browse the repository at this point in the history
…n to firmware v1.1
  • Loading branch information
dcyoung committed Apr 26, 2017
1 parent c86f73a commit fa883c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libsweep/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 7 additions & 4 deletions libsweep/src/sweep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
}
Expand Down

0 comments on commit fa883c3

Please sign in to comment.