epd-waveshare icon indicating copy to clipboard operation
epd-waveshare copied to clipboard

Add EPD 4in2bc support

Open yurinnick opened this issue 2 years ago • 5 comments

So... Does it work? Well, mostly. Display works fine as far as I can tell, however color coding is broken. For some reason 4in2bc uses a completely different scheme than anything implemented.

// 4in2bc
// White bw - 0xFF c - 0xFF
// Black bw - 0 c - 0xFF
// Red bw - 0 c - 0

// bwrbit = true
// White: bw - 0xFF c - 0
// Black: bw - 0 c - 0
// Red: bw - 0 c - 0xFF

// bwrbit = false
// White: bw - 0xFF c - 0
// Black: bw - 0 c - 0
// Red: bw - 0xFF c - 0xFF

@caemor could you help with extending TriColor implementation to match these requirements? I am willing to do it myself, let's just agree on the best way to approach it. Thanks!

yurinnick avatar Jan 26 '23 04:01 yurinnick

After this modification colors render correctly. I need to look how to integrate it with current implementation.

impl ColorType for TriColor {
    const BITS_PER_PIXEL_PER_BUFFER: usize = 1;
    const BUFFER_COUNT: usize = 2;

    fn bitmask(&self, bwrbit: bool, pos: u32) -> (u8, u16) {
        let bit = 0x80 >> (pos % 8);
        let mask = match self {
            TriColor::Black => (bit as u16) << 8,
            TriColor::White => (bit as u16) << 8 | bit as u16,
            TriColor::Chromatic => 0u16,
        };
        (!bit, mask)
    }
}

yurinnick avatar Jan 31 '23 11:01 yurinnick

Also, update_partial_frame() doesn't work for whatever reason.

yurinnick avatar Jan 31 '23 11:01 yurinnick

Hello Yurinnick, I was working on an implementation on the same screen and got the same issue about the chromatic buffer which is inverted. I have tested your implementation and can confirm it is working on EPD4IN2bc screen As a reference i use the EPD_4in2b_V2 example code from Waveshare here : https://github.com/waveshare/e-Paper

Thanks for your work, Simon

simon0356 avatar Apr 30 '23 07:04 simon0356

Sup guys, any plans on releasing this one?

struckoff avatar Aug 27 '23 19:08 struckoff

@caemor could you provide feedback please?

yurinnick avatar Aug 28 '23 05:08 yurinnick