Skip to content

fix(epd2in7b): correct V1 white and black LUT mapping#262

Open
tkj666 wants to merge 1 commit into
rust-embedded-community:mainfrom
tkj666:codex/fix-epd2in7b-v1-lut
Open

fix(epd2in7b): correct V1 white and black LUT mapping#262
tkj666 wants to merge 1 commit into
rust-embedded-community:mainfrom
tkj666:codex/fix-epd2in7b-v1-lut

Conversation

@tkj666

@tkj666 tkj666 commented Jul 20, 2026

Copy link
Copy Markdown

Summary

  • match Waveshare's 2.7-inch B V1 reference by loading LUT_BB into register 0x23 and LUT_WB into register 0x24
  • add a regression test that observes the public Epd2in7b::new initialization sequence at the SPI/DC boundary

Problem

The existing V1 driver assigns the two arrays according to their transition-style names. In B/W/Red mode, however, Waveshare's reference implementation intentionally loads them in the opposite-looking order. The current assignment swaps the final white and black drive waveforms, so a correct image can appear during the refresh phases and then settle with inverted black/white colors.

Reference: https://raw.githubusercontent.com/waveshareteam/e-Paper/master/RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in7b.c

The framebuffer-byte complement remains unchanged because it already matches the reference driver.

Verification

  • regression test failed before the mapping change and passes afterward
  • cargo test --lib — 55 passed
  • cargo check --lib
  • RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps
  • cargo clippy --lib --tests -- -D warnings -A clippy::new_ret_no_self -A clippy::doc_overindented_list_items
  • cargo fmt --all -- --check

The V1 tri-color panel uses the LUT_BB data for register 0x23 and LUT_WB for register 0x24, matching Waveshare's reference driver. Loading them by their transition-style names swaps the final white and black drive waveforms and leaves the display inverted after refresh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant