From 63321f7e2ce0f896dbb9f6b587785c0ba0bb6158 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 6 Apr 2019 08:52:42 +0200 Subject: [PATCH] Fix: Timing Issues after display_frame epd1in54 and epd2in9 were both missing a necessary wait_until_idle call at the end of their display_frame function which sometimes caused invalid/ignored commands/inputs afterwards. --- src/epd1in54/mod.rs | 5 ++++- src/epd2in9/mod.rs | 5 ++++- src/traits.rs | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/epd1in54/mod.rs b/src/epd1in54/mod.rs index 158e0ae..20df11e 100644 --- a/src/epd1in54/mod.rs +++ b/src/epd1in54/mod.rs @@ -217,7 +217,10 @@ where self.interface.cmd(spi, Command::MASTER_ACTIVATION)?; // MASTER Activation should not be interupted to avoid currption of panel images // therefore a terminate command is send - self.interface.cmd(spi, Command::NOP) + self.interface.cmd(spi, Command::NOP)?; + + self.wait_until_idle(); + Ok(()) } fn clear_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { diff --git a/src/epd2in9/mod.rs b/src/epd2in9/mod.rs index 42f062c..e8ac3b9 100644 --- a/src/epd2in9/mod.rs +++ b/src/epd2in9/mod.rs @@ -216,7 +216,10 @@ where self.interface.cmd(spi, Command::MASTER_ACTIVATION)?; // MASTER Activation should not be interupted to avoid currption of panel images // therefore a terminate command is send - self.interface.cmd(spi, Command::NOP) + self.interface.cmd(spi, Command::NOP)?; + + self.wait_until_idle(); + Ok(()) } fn clear_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { diff --git a/src/traits.rs b/src/traits.rs index 814e8cd..a689828 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -123,6 +123,8 @@ where ) -> Result<(), SPI::Error>; /// Displays the frame data from SRAM + /// + /// This function waits until the device isn`t busy anymore fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error>; /// Clears the frame buffer on the EPD with the declared background color