SdReader: fixed write cache bug.

This commit is contained in:
pca006132 2020-07-07 13:59:07 +08:00 committed by Gitea
parent e6cf3e90d3
commit 0f797284e2
1 changed files with 1 additions and 0 deletions

View File

@ -237,6 +237,7 @@ impl Write for SdReader {
let (a, b, c) = self.block_align(buf); let (a, b, c) = self.block_align(buf);
self.write_unaligned(a)?; self.write_unaligned(a)?;
if b.len() > 0 { if b.len() > 0 {
self.flush()?;
self.invalidate_buffer(); self.invalidate_buffer();
if let Err(_) = self.sd.write_block( if let Err(_) = self.sd.write_block(
self.byte_addr / BLOCK_SIZE as u32, self.byte_addr / BLOCK_SIZE as u32,