Skip to content

Commit

Permalink
cr
Browse files Browse the repository at this point in the history
  • Loading branch information
remibettan committed May 23, 2024
1 parent c7cf6ee commit 14fe1a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ds/d500/d500-fw-update-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ ds_d500_update_device::ds_d500_update_device( std::shared_ptr< const device_info
elapsed_seconds = std::chrono::duration_cast<std::chrono::seconds>(curr - start);
if (elapsed_seconds > timeout_seconds)
{
LOG_DEBUG("DFU in MANIFEST STATUS Timeout");
LOG_ERROR("DFU in MANIFEST STATUS Timeout");
return false;
}
} while (percentage_of_transfer < 100 && dfu_state == RS2_DFU_STATE_DFU_MANIFEST);
Expand Down
4 changes: 3 additions & 1 deletion src/fw-update/fw-update-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ namespace librealsense

float update_device::compute_progress(float progress, float start, float end, float threshold) const
{
if (threshold < 1.f && threshold > -1.f)
throw std::invalid_argument("Avoid division by zero");
return start + (ceil(progress * threshold) / threshold) * (end - start) / 100.f;
}

Expand Down Expand Up @@ -236,7 +238,7 @@ namespace librealsense
LOG_DEBUG("fw update progress: " << progress);
if (update_progress_callback)
{
auto progress_for_bar = compute_progress(progress, 0.f, 20.f, 5.f) / 100.f;//((ceil(progress * 5) / 5) * 20.f / 100.f) / 100.f;
auto progress_for_bar = compute_progress(progress, 0.f, 20.f, 5.f) / 100.f;
update_progress_callback->on_update_progress(progress_for_bar);
}
}
Expand Down

0 comments on commit 14fe1a4

Please sign in to comment.