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 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(()) }