From ad37cc348bef27e12f898c1047431c47a0769834 Mon Sep 17 00:00:00 2001 From: Joseph Ross Date: Sun, 20 Aug 2023 10:45:38 -0700 Subject: [PATCH] Fix timeout logic when erasing regions. --- espflash/src/flasher/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/espflash/src/flasher/mod.rs b/espflash/src/flasher/mod.rs index 7f9f6482..9a262324 100644 --- a/espflash/src/flasher/mod.rs +++ b/espflash/src/flasher/mod.rs @@ -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(())