Skip to content

Commit

Permalink
Fix timeout logic when erasing regions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnross committed Aug 20, 2023
1 parent cbc472d commit ad37cc3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions espflash/src/flasher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,10 +855,10 @@ impl Flasher {
pub fn erase_region(&mut self, offset: u32, size: u32) -> Result<(), Error> {
debug!("Erasing region of 0x{:x}B at 0x{:08x}", size, offset);

self.connection
.with_timeout(CommandType::EraseRegion.timeout(), |connection| {
connection.command(Command::EraseRegion { offset, size })
})?;
self.connection.with_timeout(
CommandType::EraseRegion.timeout_for_size(size),
|connection| connection.command(Command::EraseRegion { offset, size }),
)?;
std::thread::sleep(Duration::from_secs_f32(0.05));
self.connection.flush()?;
Ok(())
Expand Down

0 comments on commit ad37cc3

Please sign in to comment.