From bab0ba9c0fcb16a941e97ac33ed74019d7f94b2c Mon Sep 17 00:00:00 2001 From: ukewea <60734042+ukewea@users.noreply.github.com> Date: Sat, 25 Apr 2020 22:00:52 +0800 Subject: [PATCH] Change buffer sending process for waveshare_epaper (2.70in) (#1031) * Change buffer sending process for waveshare_epaper (2.70in) The current way ESPhome sending buffer to WaveshareEPaper2P7In does not show the expected content on the display, this commit is changing the data transferring process so the content is showing as expected. The process is adapted from the demo code provided by Waveshare, manufacturer of the E-paper display. * Fix linting eror --- .../waveshare_epaper/waveshare_epaper.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.cpp b/esphome/components/waveshare_epaper/waveshare_epaper.cpp index fd869b46ec..695ba9c455 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.cpp +++ b/esphome/components/waveshare_epaper/waveshare_epaper.cpp @@ -425,20 +425,22 @@ void WaveshareEPaper2P7In::initialize() { this->data(i); } void HOT WaveshareEPaper2P7In::display() { + uint32_t buf_len = this->get_buffer_length_(); + // COMMAND DATA START TRANSMISSION 1 this->command(0x10); delay(2); - this->start_data_(); - this->write_array(this->buffer_, this->get_buffer_length_()); - this->end_data_(); + for (uint32_t i = 0; i < buf_len; i++) { + this->data(this->buffer_[i]); + } delay(2); // COMMAND DATA START TRANSMISSION 2 this->command(0x13); delay(2); - this->start_data_(); - this->write_array(this->buffer_, this->get_buffer_length_()); - this->end_data_(); + for (uint32_t i = 0; i < buf_len; i++) { + this->data(this->buffer_[i]); + } // COMMAND DISPLAY REFRESH this->command(0x12);