From 66f70b3244ca61604a0275fafde8d519e3a0389c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gro=C3=9F?= Date: Mon, 16 Jul 2018 12:37:39 +0200 Subject: [PATCH] Hide the Fast Update which possible might lead to Ghosting/Burn-in effects behind a feature gate --- Cargo.toml | 5 +++++ src/epd4in2/lut.rs | 5 +++++ src/epd4in2/mod.rs | 8 ++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 03689f8..2b5c596 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,11 @@ name = "eink_waveshare_rs" version = "0.1.0" authors = ["Christoph Groß "] + +[features] +default = [] +epd4in2_fast_update = [] + [dependencies] diff --git a/src/epd4in2/lut.rs b/src/epd4in2/lut.rs index 55c7d39..ab032a5 100644 --- a/src/epd4in2/lut.rs +++ b/src/epd4in2/lut.rs @@ -8,6 +8,7 @@ pub(crate) const LUT_VCOM0: [u8; 44] = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; +#[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_VCOM0_QUICK: [u8; 44] = [ 0x00, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -28,6 +29,7 @@ pub(crate) const LUT_WW: [u8; 42] =[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; +#[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_WW_QUICK: [u8; 42] =[ 0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -49,6 +51,7 @@ pub(crate) const LUT_BW: [u8; 42] =[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; +#[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_BW_QUICK: [u8; 42] =[ 0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -70,6 +73,7 @@ pub(crate) const LUT_BB: [u8; 42] =[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; +#[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_BB_QUICK: [u8; 42] =[ 0x50, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -91,6 +95,7 @@ pub(crate) const LUT_WB: [u8; 42] =[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; +#[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_WB_QUICK: [u8; 42] =[ 0x50, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/src/epd4in2/mod.rs b/src/epd4in2/mod.rs index 3f53d9a..89bf400 100644 --- a/src/epd4in2/mod.rs +++ b/src/epd4in2/mod.rs @@ -44,8 +44,7 @@ //! //! //! -//! BE CAREFUL! The Partial Drawing can "destroy" your display. -//! It needs more testing first. +//! BE CAREFUL! The screen can get ghosting/burn-ins through the Partial Fast Update Drawing. use hal::{ @@ -268,7 +267,6 @@ where self.send_command(Command::VCOM_AND_DATA_INTERVAL_SETTING)?; //TODO: this was a send_command instead of a send_data. check if it's alright and doing what it should do (setting the default values) - //oldTODO is this really a command here or shouldn't that be data? //self.send_command_u8(0x97)?; //VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7 self.send_data(0x97)?; @@ -324,6 +322,7 @@ where /// the necessary stuff /// TODO: check delay!!! /// Displays the frame data from SRAM + #[cfg(feature = "epd4in2_fast_update")] pub fn display_frame_quick(&mut self) -> Result<(), E> { self.set_lut_quick()?; self.send_command(Command::DISPLAY_REFRESH)?; @@ -423,7 +422,8 @@ where /// Fill the look-up table for a quick display (partial refresh) /// /// Is automatically done by [EPD4in2::display_frame_quick()](EPD4in2::display_frame_quick()) - /// //TODO: make public? + /// //TODO: make public? + #[cfg(feature = "epd4in2_fast_update")] fn set_lut_quick(&mut self) -> Result<(), E> { self.set_lut_helper( &LUT_VCOM0_QUICK,