Skip to content

Commit f76d2cb

Browse files
SergioGasquezjessebraham
authored andcommitted
fix: Fix FlashDeflateData timeout
1 parent 3b024fc commit f76d2cb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

espflash/src/command.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const ERASE_WRITE_TIMEOUT_PER_MB: Duration = Duration::from_secs(40);
1313
const ERASE_CHIP_TIMEOUT: Duration = Duration::from_secs(120);
1414
const MEM_END_TIMEOUT: Duration = Duration::from_millis(50);
1515
const SYNC_TIMEOUT: Duration = Duration::from_millis(100);
16+
const FLASH_DEFLATE_END_TIMEOUT: Duration = Duration::from_secs(10);
1617

1718
/// Types of commands that can be sent to a target device
1819
#[derive(Copy, Clone, Debug, Display)]
@@ -49,6 +50,7 @@ impl CommandType {
4950
CommandType::MemEnd => MEM_END_TIMEOUT,
5051
CommandType::Sync => SYNC_TIMEOUT,
5152
CommandType::EraseFlash => ERASE_CHIP_TIMEOUT,
53+
CommandType::FlashDeflateEnd => FLASH_DEFLATE_END_TIMEOUT,
5254
_ => DEFAULT_TIMEOUT,
5355
}
5456
}
@@ -58,7 +60,7 @@ impl CommandType {
5860
fn calc_timeout(timeout_per_mb: Duration, size: u32) -> Duration {
5961
let mb = size as f64 / 1_000_000.0;
6062
std::cmp::max(
61-
DEFAULT_TIMEOUT,
63+
FLASH_DEFLATE_END_TIMEOUT,
6264
Duration::from_millis((timeout_per_mb.as_millis() as f64 * mb) as u64),
6365
)
6466
}

0 commit comments

Comments
 (0)