Skip to content

Commit 2f70a8b

Browse files
committed
fix: account for slip escape sequences (?)
1 parent 1b600c6 commit 2f70a8b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

espflash/src/command.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ const SYNC_TIMEOUT: Duration = Duration::from_millis(100);
2020
const FLASH_DEFLATE_END_TIMEOUT: Duration = Duration::from_secs(10);
2121
const FLASH_MD5_TIMEOUT_PER_MB: Duration = Duration::from_secs(8);
2222

23-
// max response length for a non-vector request
23+
// 44 is a max response length for a non-vector request.
24+
// doubling is performed due to possible escapes in the slip decoder
2425
#[cfg(feature = "serialport")]
25-
const SYNC_MAX_LEN: u64 = 44;
26-
// 1Gi, max response length ever expected
26+
const SYNC_MAX_LEN: u64 = 44 * 2;
27+
// 8Mi is a max response length ever expected
28+
// doubling is performed due to possible escapes in the slip decoder
2729
#[cfg(feature = "serialport")]
28-
pub(crate) const DEFAULT_MAX_LEN: u64 = 1024 * 1024 * 1024;
30+
pub(crate) const DEFAULT_MAX_LEN: u64 = 8 * 1024 * 1024 * 2;
2931

3032
/// Input data for SYNC command (36 bytes: 0x07 0x07 0x12 0x20, followed by
3133
/// 32 x 0x55)

0 commit comments

Comments
 (0)