Skip to content

Commit

Permalink
Flush buffer after writing command (#521)
Browse files Browse the repository at this point in the history
* Flush buffer after writing command

* Add to changelog
  • Loading branch information
bugadani authored Nov 23, 2023
1 parent 775e222 commit 0420d79
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 7 additions & 1 deletion espflash/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -207,6 +212,7 @@ impl Connection {
let mut encoder = SlipEncoder::new(&mut writer)?;
command.write(&mut encoder)?;
encoder.finish()?;
writer.flush()?;
Ok(())
}

Expand Down

0 comments on commit 0420d79

Please sign in to comment.