From 0d873c1545991735eb29b0f91e9bd350a82427fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Thu, 23 Nov 2023 15:25:40 +0100 Subject: [PATCH 1/2] Flush buffer after writing command --- espflash/src/connection/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/espflash/src/connection/mod.rs b/espflash/src/connection/mod.rs index 1f4ff20a..ab885fa4 100644 --- a/espflash/src/connection/mod.rs +++ b/espflash/src/connection/mod.rs @@ -4,7 +4,12 @@ //! sending/decoding of commands, and provides higher-level operations with the //! device. -use std::{io::BufWriter, iter::zip, thread::sleep, time::Duration}; +use std::{ + io::{BufWriter, Write}, + iter::zip, + thread::sleep, + time::Duration, +}; use binrw::{io::Cursor, BinRead, BinReaderExt}; use log::debug; @@ -207,6 +212,7 @@ impl Connection { let mut encoder = SlipEncoder::new(&mut writer)?; command.write(&mut encoder)?; encoder.finish()?; + writer.flush()?; Ok(()) } From a8f70c9c0191300b4752b40a7b369e70866925a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Thu, 23 Nov 2023 16:51:12 +0100 Subject: [PATCH 2/2] Add to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0602b88..b54a7bde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed printing panic backtraces when using `esp-println` and `defmt` (#496) - Fixed defmt parsing when data is read in parts (#503) - Use partition table instead of hard-coded values for the location of partitions (#516) +- Fixed a missed `flush` call that may be causing communication errors (#521) ### Changed