Skip to content

Commit

Permalink
optional flash backup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az committed Oct 16, 2023
1 parent 19a8926 commit da6932a
Showing 1 changed file with 32 additions and 26 deletions.
58 changes: 32 additions & 26 deletions common/fw-update-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,20 @@ namespace rs2
return;
}
}
if ( ! _is_d500_device )

log( "Trying to back-up camera flash memory" );

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

std::string log_backup_status;
try
// Not all cameras supports this feature
if( !flash.empty() )
{
auto flash = upd.create_flash_backup( [&]( const float progress )
{
_progress = ( ( 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";

Expand All @@ -240,28 +242,32 @@ namespace rs2
log_backup_status = "Backup completed and saved as '" + temp + "'";
}
}
catch( const std::exception& e )
else
{
if( auto not_model_protected = get_protected_notification_model() )
{
log_backup_status = "WARNING: backup failed; continuing without it...";
not_model_protected->output.add_log( RS2_LOG_SEVERITY_WARN,
__FILE__,
__LINE__,
log_backup_status + ", Error: " + e.what() );
}
log_backup_status = "Back-up camera flash cannot be saved";
}
catch( ... )
}
catch( const std::exception& e )
{
if( auto not_model_protected = get_protected_notification_model() )
{
if( auto not_model_protected = get_protected_notification_model() )
{
log_backup_status = "WARNING: backup failed; continuing without it...";
not_model_protected->add_log( log_backup_status + ", Unknown error occurred" );
}
log_backup_status = "WARNING: backup failed; continuing without it...";
not_model_protected->output.add_log( RS2_LOG_SEVERITY_WARN,
__FILE__,
__LINE__,
log_backup_status + ", Error: " + e.what() );
}

log(log_backup_status);
}
catch( ... )
{
if( auto not_model_protected = get_protected_notification_model() )
{
log_backup_status = "WARNING: backup failed; continuing without it...";
not_model_protected->add_log( log_backup_status + ", Unknown error occurred" );
}
}

log(log_backup_status);



Expand Down

0 comments on commit da6932a

Please sign in to comment.