Skip to content

Commit 0420d79

Browse files
authored
Flush buffer after writing command (#521)
* Flush buffer after writing command * Add to changelog
1 parent 775e222 commit 0420d79

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020
- Fixed printing panic backtraces when using `esp-println` and `defmt` (#496)
2121
- Fixed defmt parsing when data is read in parts (#503)
2222
- Use partition table instead of hard-coded values for the location of partitions (#516)
23+
- Fixed a missed `flush` call that may be causing communication errors (#521)
2324

2425
### Changed
2526

espflash/src/connection/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
//! sending/decoding of commands, and provides higher-level operations with the
55
//! device.
66
7-
use std::{io::BufWriter, iter::zip, thread::sleep, time::Duration};
7+
use std::{
8+
io::{BufWriter, Write},
9+
iter::zip,
10+
thread::sleep,
11+
time::Duration,
12+
};
813

914
use binrw::{io::Cursor, BinRead, BinReaderExt};
1015
use log::debug;
@@ -207,6 +212,7 @@ impl Connection {
207212
let mut encoder = SlipEncoder::new(&mut writer)?;
208213
command.write(&mut encoder)?;
209214
encoder.finish()?;
215+
writer.flush()?;
210216
Ok(())
211217
}
212218

0 commit comments

Comments
 (0)