Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundled firmware update no longer fail if backup step fail #7241

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions common/fw-update-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,22 +194,38 @@ namespace rs2
{
log("Backing-up camera flash memory");

auto flash = upd.create_flash_backup([&](const float progress)
std::string log_backup_status;
try
{
_progress = int((ceil(progress * 5) / 5) * (30 - next_progress)) + next_progress;
});
auto flash = upd.create_flash_backup([&](const float progress)
{
_progress = int((ceil(progress * 5) / 5) * (30 - next_progress)) + next_progress;
});

auto temp = get_folder_path(special_folder::app_data);
temp += serial + "." + get_timestamped_file_name() + ".bin";
auto temp = get_folder_path(special_folder::app_data);
temp += serial + "." + get_timestamped_file_name() + ".bin";

{
std::ofstream file(temp.c_str(), std::ios::binary);
file.write((const char*)flash.data(), flash.size());
log_backup_status = "Backup completed and saved as '" + temp + "'";
}
}
catch (const std::exception& e)
{
log_backup_status = "WARNING: backup failed; continuing without it...";
_viewer.not_model->output.add_log(RS2_LOG_SEVERITY_WARN,
__FILE__,
__LINE__,
log_backup_status + ", Error: " + e.what());
}
catch ( ... )
{
std::ofstream file(temp.c_str(), std::ios::binary);
file.write((const char*)flash.data(), flash.size());
log_backup_status = "WARNING: backup failed; continuing without it...";
_viewer.not_model->add_log(log_backup_status + ", Unknown error occurred");
}

std::string log_line = "Backup completed and saved as '";
log_line += temp + "'";
log(log_line);
log(log_backup_status);

next_progress = 40;

Expand Down